Text Compare
Produced: 7/19/2015 1:53:56 PM
   
Mode:  All, With Context  
Left file: C:\mksong\workspace_genproglase\genproglase-output-r1658\template09\0718-1345\libtiff-bug-2009-02-05-764dbba-2e42d63\sanity\tools\tiffcrop.c  
Right file: C:\mksong\workspace_genproglase\genproglase-output-r1658\template09\0718-1345\libtiff-bug-2009-02-05-764dbba-2e42d63\000000\tools\tiffcrop.c  
1 typedef unsigned char __u_char; = 1 typedef unsigned char __u_char;
2 typedef unsigned short __u_short;   2 typedef unsigned short __u_short;
3 typedef unsigned int __u_int;   3 typedef unsigned int __u_int;
4 typedef unsigned long __u_long;   4 typedef unsigned long __u_long;
5 typedef signed char __int8_t;   5 typedef signed char __int8_t;
6 typedef unsigned char __uint8_t;   6 typedef unsigned char __uint8_t;
7 typedef short __int16_t;   7 typedef short __int16_t;
8 typedef unsigned short __uint16_t;   8 typedef unsigned short __uint16_t;
9 typedef int __int32_t;   9 typedef int __int32_t;
10 typedef unsigned int __uint32_t;   10 typedef unsigned int __uint32_t;
11 typedef long long __int64_t;   11 typedef long long __int64_t;
12 typedef unsigned long long __uint64_t;   12 typedef unsigned long long __uint64_t;
13 typedef long long __quad_t;   13 typedef long long __quad_t;
14 typedef unsigned long long __u_quad_t;   14 typedef unsigned long long __u_quad_t;
15 typedef __u_quad_t __dev_t;   15 typedef __u_quad_t __dev_t;
16 typedef unsigned int __uid_t;   16 typedef unsigned int __uid_t;
17 typedef unsigned int __gid_t;   17 typedef unsigned int __gid_t;
18 typedef unsigned long __ino_t;   18 typedef unsigned long __ino_t;
19 typedef __u_quad_t __ino64_t;   19 typedef __u_quad_t __ino64_t;
20 typedef unsigned int __mode_t;   20 typedef unsigned int __mode_t;
21 typedef unsigned int __nlink_t;   21 typedef unsigned int __nlink_t;
22 typedef long __off_t;   22 typedef long __off_t;
23 typedef __quad_t __off64_t;   23 typedef __quad_t __off64_t;
24 typedef int __pid_t;   24 typedef int __pid_t;
25 struct __anonstruct___fsid_t_1 {   25 struct __anonstruct___fsid_t_1 {
26    int __val[2] ;   26    int __val[2] ;
27 };   27 };
28 typedef struct __anonstruct___fsid_t_1 __fsid_t;   28 typedef struct __anonstruct___fsid_t_1 __fsid_t;
29 typedef long __clock_t;   29 typedef long __clock_t;
30 typedef unsigned long __rlim_t;   30 typedef unsigned long __rlim_t;
31 typedef __u_quad_t __rlim64_t;   31 typedef __u_quad_t __rlim64_t;
32 typedef unsigned int __id_t;   32 typedef unsigned int __id_t;
33 typedef long __time_t;   33 typedef long __time_t;
34 typedef unsigned int __useconds_t;   34 typedef unsigned int __useconds_t;
35 typedef long __suseconds_t;   35 typedef long __suseconds_t;
36 typedef int __daddr_t;   36 typedef int __daddr_t;
37 typedef long __swblk_t;   37 typedef long __swblk_t;
38 typedef int __key_t;   38 typedef int __key_t;
39 typedef int __clockid_t;   39 typedef int __clockid_t;
40 typedef void *__timer_t;   40 typedef void *__timer_t;
41 typedef long __blksize_t;   41 typedef long __blksize_t;
42 typedef long __blkcnt_t;   42 typedef long __blkcnt_t;
43 typedef __quad_t __blkcnt64_t;   43 typedef __quad_t __blkcnt64_t;
44 typedef unsigned long __fsblkcnt_t;   44 typedef unsigned long __fsblkcnt_t;
45 typedef __u_quad_t __fsblkcnt64_t;   45 typedef __u_quad_t __fsblkcnt64_t;
46 typedef unsigned long __fsfilcnt_t;   46 typedef unsigned long __fsfilcnt_t;
47 typedef __u_quad_t __fsfilcnt64_t;   47 typedef __u_quad_t __fsfilcnt64_t;
48 typedef int __ssize_t;   48 typedef int __ssize_t;
49 typedef __off64_t __loff_t;   49 typedef __off64_t __loff_t;
50 typedef __quad_t *__qaddr_t;   50 typedef __quad_t *__qaddr_t;
51 typedef char *__caddr_t;   51 typedef char *__caddr_t;
52 typedef int __intptr_t;   52 typedef int __intptr_t;
53 typedef unsigned int __socklen_t;   53 typedef unsigned int __socklen_t;
54 typedef __u_char u_char;   54 typedef __u_char u_char;
55 typedef __u_short u_short;   55 typedef __u_short u_short;
56 typedef __u_int u_int;   56 typedef __u_int u_int;
57 typedef __u_long u_long;   57 typedef __u_long u_long;
58 typedef __quad_t quad_t;   58 typedef __quad_t quad_t;
59 typedef __u_quad_t u_quad_t;   59 typedef __u_quad_t u_quad_t;
60 typedef __fsid_t fsid_t;   60 typedef __fsid_t fsid_t;
61 typedef __loff_t loff_t;   61 typedef __loff_t loff_t;
62 typedef __ino64_t ino_t;   62 typedef __ino64_t ino_t;
63 typedef __dev_t dev_t;   63 typedef __dev_t dev_t;
64 typedef __gid_t gid_t;   64 typedef __gid_t gid_t;
65 typedef __mode_t mode_t;   65 typedef __mode_t mode_t;
66 typedef __nlink_t nlink_t;   66 typedef __nlink_t nlink_t;
67 typedef __uid_t uid_t;   67 typedef __uid_t uid_t;
68 typedef __off64_t off_t;   68 typedef __off64_t off_t;
69 typedef __pid_t pid_t;   69 typedef __pid_t pid_t;
70 typedef __id_t id_t;   70 typedef __id_t id_t;
71 typedef __ssize_t ssize_t;   71 typedef __ssize_t ssize_t;
72 typedef __daddr_t daddr_t;   72 typedef __daddr_t daddr_t;
73 typedef __caddr_t caddr_t;   73 typedef __caddr_t caddr_t;
74 typedef __key_t key_t;   74 typedef __key_t key_t;
75 typedef __clock_t clock_t;   75 typedef __clock_t clock_t;
76 typedef __time_t time_t;   76 typedef __time_t time_t;
77 typedef __clockid_t clockid_t;   77 typedef __clockid_t clockid_t;
78 typedef __timer_t timer_t;   78 typedef __timer_t timer_t;
79 typedef unsigned int size_t;   79 typedef unsigned int size_t;
80 typedef unsigned long ulong;   80 typedef unsigned long ulong;
81 typedef unsigned short ushort;   81 typedef unsigned short ushort;
82 typedef unsigned int uint;   82 typedef unsigned int uint;
83 typedef signed char int8_t;   83 typedef signed char int8_t;
84 typedef short int16_t;   84 typedef short int16_t;
85 typedef int int32_t;   85 typedef int int32_t;
86 typedef long long int64_t;   86 typedef long long int64_t;
87 typedef unsigned char u_int8_t;   87 typedef unsigned char u_int8_t;
88 typedef unsigned short u_int16_t;   88 typedef unsigned short u_int16_t;
89 typedef unsigned int u_int32_t;   89 typedef unsigned int u_int32_t;
90 typedef unsigned long long u_int64_t;   90 typedef unsigned long long u_int64_t;
91 typedef int register_t;   91 typedef int register_t;
92 typedef int __sig_atomic_t;   92 typedef int __sig_atomic_t;
93 struct __anonstruct___sigset_t_2 {   93 struct __anonstruct___sigset_t_2 {
94    unsigned long __val[1024U / (8U * sizeof(unsigned long ))] ;   94    unsigned long __val[1024U / (8U * sizeof(unsigned long ))] ;
95 };   95 };
96 typedef struct __anonstruct___sigset_t_2 __sigset_t;   96 typedef struct __anonstruct___sigset_t_2 __sigset_t;
97 typedef __sigset_t sigset_t;   97 typedef __sigset_t sigset_t;
98 struct timespec {   98 struct timespec {
99    __time_t tv_sec ;   99    __time_t tv_sec ;
100    long tv_nsec ;   100    long tv_nsec ;
101 };   101 };
102 struct timeval {   102 struct timeval {
103    __time_t tv_sec ;   103    __time_t tv_sec ;
104    __suseconds_t tv_usec ;   104    __suseconds_t tv_usec ;
105 };   105 };
106 typedef __suseconds_t suseconds_t;   106 typedef __suseconds_t suseconds_t;
107 typedef long __fd_mask;   107 typedef long __fd_mask;
108 struct __anonstruct_fd_set_3 {   108 struct __anonstruct_fd_set_3 {
109    __fd_mask __fds_bits[1024 / (8 * (int )sizeof(__fd_mask ))] ;   109    __fd_mask __fds_bits[1024 / (8 * (int )sizeof(__fd_mask ))] ;
110 };   110 };
111 typedef struct __anonstruct_fd_set_3 fd_set;   111 typedef struct __anonstruct_fd_set_3 fd_set;
112 typedef __fd_mask fd_mask;   112 typedef __fd_mask fd_mask;
113 typedef __blksize_t blksize_t;   113 typedef __blksize_t blksize_t;
114 typedef __blkcnt64_t blkcnt_t;   114 typedef __blkcnt64_t blkcnt_t;
115 typedef __fsblkcnt64_t fsblkcnt_t;   115 typedef __fsblkcnt64_t fsblkcnt_t;
116 typedef __fsfilcnt64_t fsfilcnt_t;   116 typedef __fsfilcnt64_t fsfilcnt_t;
117 typedef unsigned long pthread_t;   117 typedef unsigned long pthread_t;
118 union __anonunion_pthread_attr_t_4 {   118 union __anonunion_pthread_attr_t_4 {
119    char __size[36] ;   119    char __size[36] ;
120    long __align ;   120    long __align ;
121 };   121 };
122 typedef union __anonunion_pthread_attr_t_4 pthread_attr_t;   122 typedef union __anonunion_pthread_attr_t_4 pthread_attr_t;
123 struct __pthread_internal_slist {   123 struct __pthread_internal_slist {
124    struct __pthread_internal_slist *__next ;   124    struct __pthread_internal_slist *__next ;
125 };   125 };
126 typedef struct __pthread_internal_slist __pthread_slist_t;   126 typedef struct __pthread_internal_slist __pthread_slist_t;
127 union __anonunion____missing_field_name_6 {   127 union __anonunion____missing_field_name_6 {
128    int __spins ;   128    int __spins ;
129    __pthread_slist_t __list ;   129    __pthread_slist_t __list ;
130 };   130 };
131 struct __pthread_mutex_s {   131 struct __pthread_mutex_s {
132    int __lock ;   132    int __lock ;
133    unsigned int __count ;   133    unsigned int __count ;
134    int __owner ;   134    int __owner ;
135    int __kind ;   135    int __kind ;
136    unsigned int __nusers ;   136    unsigned int __nusers ;
137    union __anonunion____missing_field_name_6 __annonCompField1 ;   137    union __anonunion____missing_field_name_6 __annonCompField1 ;
138 };   138 };
139 union __anonunion_pthread_mutex_t_5 {   139 union __anonunion_pthread_mutex_t_5 {
140    struct __pthread_mutex_s __data ;   140    struct __pthread_mutex_s __data ;
141    char __size[24] ;   141    char __size[24] ;
142    long __align ;   142    long __align ;
143 };   143 };
144 typedef union __anonunion_pthread_mutex_t_5 pthread_mutex_t;   144 typedef union __anonunion_pthread_mutex_t_5 pthread_mutex_t;
145 union __anonunion_pthread_mutexattr_t_7 {   145 union __anonunion_pthread_mutexattr_t_7 {
146    char __size[4] ;   146    char __size[4] ;
147    long __align ;   147    long __align ;
148 };   148 };
149 typedef union __anonunion_pthread_mutexattr_t_7 pthread_mutexattr_t;   149 typedef union __anonunion_pthread_mutexattr_t_7 pthread_mutexattr_t;
150 struct __anonstruct___data_9 {   150 struct __anonstruct___data_9 {
151    int __lock ;   151    int __lock ;
152    unsigned int __futex ;   152    unsigned int __futex ;
153    unsigned long long __total_seq ;   153    unsigned long long __total_seq ;
154    unsigned long long __wakeup_seq ;   154    unsigned long long __wakeup_seq ;
155    unsigned long long __woken_seq ;   155    unsigned long long __woken_seq ;
156    void *__mutex ;   156    void *__mutex ;
157    unsigned int __nwaiters ;   157    unsigned int __nwaiters ;
158    unsigned int __broadcast_seq ;   158    unsigned int __broadcast_seq ;
159 };   159 };
160 union __anonunion_pthread_cond_t_8 {   160 union __anonunion_pthread_cond_t_8 {
161    struct __anonstruct___data_9 __data ;   161    struct __anonstruct___data_9 __data ;
162    char __size[48] ;   162    char __size[48] ;
163    long long __align ;   163    long long __align ;
164 };   164 };
165 typedef union __anonunion_pthread_cond_t_8 pthread_cond_t;   165 typedef union __anonunion_pthread_cond_t_8 pthread_cond_t;
166 union __anonunion_pthread_condattr_t_10 {   166 union __anonunion_pthread_condattr_t_10 {
167    char __size[4] ;   167    char __size[4] ;
168    long __align ;   168    long __align ;
169 };   169 };
170 typedef union __anonunion_pthread_condattr_t_10 pthread_condattr_t;   170 typedef union __anonunion_pthread_condattr_t_10 pthread_condattr_t;
171 typedef unsigned int pthread_key_t;   171 typedef unsigned int pthread_key_t;
172 typedef int pthread_once_t;   172 typedef int pthread_once_t;
173 struct __anonstruct___data_12 {   173 struct __anonstruct___data_12 {
174    int __lock ;   174    int __lock ;
175    unsigned int __nr_readers ;   175    unsigned int __nr_readers ;
176    unsigned int __readers_wakeup ;   176    unsigned int __readers_wakeup ;
177    unsigned int __writer_wakeup ;   177    unsigned int __writer_wakeup ;
178    unsigned int __nr_readers_queued ;   178    unsigned int __nr_readers_queued ;
179    unsigned int __nr_writers_queued ;   179    unsigned int __nr_writers_queued ;
180    unsigned char __flags ;   180    unsigned char __flags ;
181    unsigned char __shared ;   181    unsigned char __shared ;
182    unsigned char __pad1 ;   182    unsigned char __pad1 ;
183    unsigned char __pad2 ;   183    unsigned char __pad2 ;
184    int __writer ;   184    int __writer ;
185 };   185 };
186 union __anonunion_pthread_rwlock_t_11 {   186 union __anonunion_pthread_rwlock_t_11 {
187    struct __anonstruct___data_12 __data ;   187    struct __anonstruct___data_12 __data ;
188    char __size[32] ;   188    char __size[32] ;
189    long __align ;   189    long __align ;
190 };   190 };
191 typedef union __anonunion_pthread_rwlock_t_11 pthread_rwlock_t;   191 typedef union __anonunion_pthread_rwlock_t_11 pthread_rwlock_t;
192 union __anonunion_pthread_rwlockattr_t_13 {   192 union __anonunion_pthread_rwlockattr_t_13 {
193    char __size[8] ;   193    char __size[8] ;
194    long __align ;   194    long __align ;
195 };   195 };
196 typedef union __anonunion_pthread_rwlockattr_t_13 pthread_rwlockattr_t;   196 typedef union __anonunion_pthread_rwlockattr_t_13 pthread_rwlockattr_t;
197 typedef int volatile   pthread_spinlock_t;   197 typedef int volatile   pthread_spinlock_t;
198 union __anonunion_pthread_barrier_t_14 {   198 union __anonunion_pthread_barrier_t_14 {
199    char __size[20] ;   199    char __size[20] ;
200    long __align ;   200    long __align ;
201 };   201 };
202 typedef union __anonunion_pthread_barrier_t_14 pthread_barrier_t;   202 typedef union __anonunion_pthread_barrier_t_14 pthread_barrier_t;
203 union __anonunion_pthread_barrierattr_t_15 {   203 union __anonunion_pthread_barrierattr_t_15 {
204    char __size[4] ;   204    char __size[4] ;
205    int __align ;   205    int __align ;
206 };   206 };
207 typedef union __anonunion_pthread_barrierattr_t_15 pthread_barrierattr_t;   207 typedef union __anonunion_pthread_barrierattr_t_15 pthread_barrierattr_t;
208 struct flock {   208 struct flock {
209    short l_type ;   209    short l_type ;
210    short l_whence ;   210    short l_whence ;
211    __off64_t l_start ;   211    __off64_t l_start ;
212    __off64_t l_len ;   212    __off64_t l_len ;
213    __pid_t l_pid ;   213    __pid_t l_pid ;
214 };   214 };
215 struct stat {   215 struct stat {
216    __dev_t st_dev ;   216    __dev_t st_dev ;
217    unsigned short __pad1 ;   217    unsigned short __pad1 ;
218    __ino_t __st_ino ;   218    __ino_t __st_ino ;
219    __mode_t st_mode ;   219    __mode_t st_mode ;
220    __nlink_t st_nlink ;   220    __nlink_t st_nlink ;
221    __uid_t st_uid ;   221    __uid_t st_uid ;
222    __gid_t st_gid ;   222    __gid_t st_gid ;
223    __dev_t st_rdev ;   223    __dev_t st_rdev ;
224    unsigned short __pad2 ;   224    unsigned short __pad2 ;
225    __off64_t st_size ;   225    __off64_t st_size ;
226    __blksize_t st_blksize ;   226    __blksize_t st_blksize ;
227    __blkcnt64_t st_blocks ;   227    __blkcnt64_t st_blocks ;
228    struct timespec st_atim ;   228    struct timespec st_atim ;
229    struct timespec st_mtim ;   229    struct timespec st_mtim ;
230    struct timespec st_ctim ;   230    struct timespec st_ctim ;
231    __ino64_t st_ino ;   231    __ino64_t st_ino ;
232 };   232 };
233 struct __locale_data;   233 struct __locale_data;
234 struct __locale_struct {   234 struct __locale_struct {
235    struct __locale_data *__locales[13] ;   235    struct __locale_data *__locales[13] ;
236    unsigned short const   *__ctype_b ;   236    unsigned short const   *__ctype_b ;
237    int const   *__ctype_tolower ;   237    int const   *__ctype_tolower ;
238    int const   *__ctype_toupper ;   238    int const   *__ctype_toupper ;
239    char const   *__names[13] ;   239    char const   *__names[13] ;
240 };   240 };
241 typedef struct __locale_struct *__locale_t;   241 typedef struct __locale_struct *__locale_t;
242 typedef __locale_t locale_t;   242 typedef __locale_t locale_t;
243 typedef int (*__compar_fn_t)(void const   * , void const   * );   243 typedef int (*__compar_fn_t)(void const   * , void const   * );
244 enum __anonenum_ACTION_16 {   244 enum __anonenum_ACTION_16 {
245     FIND = 0,   245     FIND = 0,
246     ENTER = 1   246     ENTER = 1
247 } ;   247 } ;
248 typedef enum __anonenum_ACTION_16 ACTION;   248 typedef enum __anonenum_ACTION_16 ACTION;
249 struct entry {   249 struct entry {
250    char *key ;   250    char *key ;
251    void *data ;   251    void *data ;
252 };   252 };
253 typedef struct entry ENTRY;   253 typedef struct entry ENTRY;
254 struct _ENTRY;   254 struct _ENTRY;
255 struct _ENTRY;   255 struct _ENTRY;
256 enum __anonenum_VISIT_17 {   256 enum __anonenum_VISIT_17 {
257     preorder = 0,   257     preorder = 0,
258     postorder = 1,   258     postorder = 1,
259     endorder = 2,   259     endorder = 2,
260     leaf = 3   260     leaf = 3
261 } ;   261 } ;
262 typedef enum __anonenum_VISIT_17 VISIT;   262 typedef enum __anonenum_VISIT_17 VISIT;
263 typedef void (*__action_fn_t)(void const   *__nodep , VISIT __value ,   263 typedef void (*__action_fn_t)(void const   *__nodep , VISIT __value ,
264                               int __level );   264                               int __level );
265 typedef signed char int8;   265 typedef signed char int8;
266 typedef unsigned char uint8;   266 typedef unsigned char uint8;
267 typedef short int16;   267 typedef short int16;
268 typedef unsigned short uint16;   268 typedef unsigned short uint16;
269 typedef int int32;   269 typedef int int32;
270 typedef unsigned int uint32;   270 typedef unsigned int uint32;
271 typedef long long int64;   271 typedef long long int64;
272 typedef unsigned long long uint64;   272 typedef unsigned long long uint64;
273 typedef int uint16_vap;   273 typedef int uint16_vap;
274 struct __anonstruct_TIFFHeaderCommon_18 {   274 struct __anonstruct_TIFFHeaderCommon_18 {
275    uint16 tiff_magic ;   275    uint16 tiff_magic ;
276    uint16 tiff_version ;   276    uint16 tiff_version ;
277 };   277 };
278 typedef struct __anonstruct_TIFFHeaderCommon_18 TIFFHeaderCommon;   278 typedef struct __anonstruct_TIFFHeaderCommon_18 TIFFHeaderCommon;
279 struct __anonstruct_TIFFHeaderClassic_19 {   279 struct __anonstruct_TIFFHeaderClassic_19 {
280    uint16 tiff_magic ;   280    uint16 tiff_magic ;
281    uint16 tiff_version ;   281    uint16 tiff_version ;
282    uint32 tiff_diroff ;   282    uint32 tiff_diroff ;
283 };   283 };
284 typedef struct __anonstruct_TIFFHeaderClassic_19 TIFFHeaderClassic;   284 typedef struct __anonstruct_TIFFHeaderClassic_19 TIFFHeaderClassic;
285 struct __anonstruct_TIFFHeaderBig_20 {   285 struct __anonstruct_TIFFHeaderBig_20 {
286    uint16 tiff_magic ;   286    uint16 tiff_magic ;
287    uint16 tiff_version ;   287    uint16 tiff_version ;
288    uint16 tiff_offsetsize ;   288    uint16 tiff_offsetsize ;
289    uint16 tiff_unused ;   289    uint16 tiff_unused ;
290    uint64 tiff_diroff ;   290    uint64 tiff_diroff ;
291 };   291 };
292 typedef struct __anonstruct_TIFFHeaderBig_20 TIFFHeaderBig;   292 typedef struct __anonstruct_TIFFHeaderBig_20 TIFFHeaderBig;
293 enum __anonenum_TIFFDataType_21 {   293 enum __anonenum_TIFFDataType_21 {
294     TIFF_NOTYPE = 0,   294     TIFF_NOTYPE = 0,
295     TIFF_BYTE = 1,   295     TIFF_BYTE = 1,
296     TIFF_ASCII = 2,   296     TIFF_ASCII = 2,
297     TIFF_SHORT = 3,   297     TIFF_SHORT = 3,
298     TIFF_LONG = 4,   298     TIFF_LONG = 4,
299     TIFF_RATIONAL = 5,   299     TIFF_RATIONAL = 5,
300     TIFF_SBYTE = 6,   300     TIFF_SBYTE = 6,
301     TIFF_UNDEFINED = 7,   301     TIFF_UNDEFINED = 7,
302     TIFF_SSHORT = 8,   302     TIFF_SSHORT = 8,
303     TIFF_SLONG = 9,   303     TIFF_SLONG = 9,
304     TIFF_SRATIONAL = 10,   304     TIFF_SRATIONAL = 10,
305     TIFF_FLOAT = 11,   305     TIFF_FLOAT = 11,
306     TIFF_DOUBLE = 12,   306     TIFF_DOUBLE = 12,
307     TIFF_IFD = 13,   307     TIFF_IFD = 13,
308     TIFF_LONG8 = 16,   308     TIFF_LONG8 = 16,
309     TIFF_SLONG8 = 17,   309     TIFF_SLONG8 = 17,
310     TIFF_IFD8 = 18   310     TIFF_IFD8 = 18
311 } ;   311 } ;
312 typedef enum __anonenum_TIFFDataType_21 TIFFDataType;   312 typedef enum __anonenum_TIFFDataType_21 TIFFDataType;
313 struct tiff;   313 struct tiff;
314 typedef struct tiff TIFF;   314 typedef struct tiff TIFF;
315 typedef long tmsize_t;   315 typedef long tmsize_t;
316 typedef uint64 toff_t;   316 typedef uint64 toff_t;
317 typedef uint32 ttag_t;   317 typedef uint32 ttag_t;
318 typedef uint16 tdir_t;   318 typedef uint16 tdir_t;
319 typedef uint16 tsample_t;   319 typedef uint16 tsample_t;
320 typedef uint32 tstrile_t;   320 typedef uint32 tstrile_t;
321 typedef tstrile_t tstrip_t;   321 typedef tstrile_t tstrip_t;
322 typedef tstrile_t ttile_t;   322 typedef tstrile_t ttile_t;
323 typedef tmsize_t tsize_t;   323 typedef tmsize_t tsize_t;
324 typedef void *tdata_t;   324 typedef void *tdata_t;
325 typedef void *thandle_t;   325 typedef void *thandle_t;
326 typedef unsigned char TIFFRGBValue;   326 typedef unsigned char TIFFRGBValue;
327 struct __anonstruct_TIFFDisplay_22 {   327 struct __anonstruct_TIFFDisplay_22 {
328    float d_mat[3][3] ;   328    float d_mat[3][3] ;
329    float d_YCR ;   329    float d_YCR ;
330    float d_YCG ;   330    float d_YCG ;
331    float d_YCB ;   331    float d_YCB ;
332    uint32 d_Vrwr ;   332    uint32 d_Vrwr ;
333    uint32 d_Vrwg ;   333    uint32 d_Vrwg ;
334    uint32 d_Vrwb ;   334    uint32 d_Vrwb ;
335    float d_Y0R ;   335    float d_Y0R ;
336    float d_Y0G ;   336    float d_Y0G ;
337    float d_Y0B ;   337    float d_Y0B ;
338    float d_gammaR ;   338    float d_gammaR ;
339    float d_gammaG ;   339    float d_gammaG ;
340    float d_gammaB ;   340    float d_gammaB ;
341 };   341 };
342 typedef struct __anonstruct_TIFFDisplay_22 TIFFDisplay;   342 typedef struct __anonstruct_TIFFDisplay_22 TIFFDisplay;
343 struct __anonstruct_TIFFYCbCrToRGB_23 {   343 struct __anonstruct_TIFFYCbCrToRGB_23 {
344    TIFFRGBValue *clamptab ;   344    TIFFRGBValue *clamptab ;
345    int *Cr_r_tab ;   345    int *Cr_r_tab ;
346    int *Cb_b_tab ;   346    int *Cb_b_tab ;
347    int32 *Cr_g_tab ;   347    int32 *Cr_g_tab ;
348    int32 *Cb_g_tab ;   348    int32 *Cb_g_tab ;
349    int32 *Y_tab ;   349    int32 *Y_tab ;
350 };   350 };
351 typedef struct __anonstruct_TIFFYCbCrToRGB_23 TIFFYCbCrToRGB;   351 typedef struct __anonstruct_TIFFYCbCrToRGB_23 TIFFYCbCrToRGB;
352 struct __anonstruct_TIFFCIELabToRGB_24 {   352 struct __anonstruct_TIFFCIELabToRGB_24 {
353    int range ;   353    int range ;
354    float rstep ;   354    float rstep ;
355    float gstep ;   355    float gstep ;
356    float bstep ;   356    float bstep ;
357    float X0 ;   357    float X0 ;
358    float Y0 ;   358    float Y0 ;
359    float Z0 ;   359    float Z0 ;
360    TIFFDisplay display ;   360    TIFFDisplay display ;
361    float Yr2r[1501] ;   361    float Yr2r[1501] ;
362    float Yg2g[1501] ;   362    float Yg2g[1501] ;
363    float Yb2b[1501] ;   363    float Yb2b[1501] ;
364 };   364 };
365 typedef struct __anonstruct_TIFFCIELabToRGB_24 TIFFCIELabToRGB;   365 typedef struct __anonstruct_TIFFCIELabToRGB_24 TIFFCIELabToRGB;
366 struct _TIFFRGBAImage;   366 struct _TIFFRGBAImage;
367 typedef struct _TIFFRGBAImage TIFFRGBAImage;   367 typedef struct _TIFFRGBAImage TIFFRGBAImage;
368 typedef void (*tileContigRoutine)(TIFFRGBAImage * , uint32 * , uint32  ,   368 typedef void (*tileContigRoutine)(TIFFRGBAImage * , uint32 * , uint32  ,
369                                   uint32  , uint32  , uint32  , int32  ,   369                                   uint32  , uint32  , uint32  , int32  ,
370                                   int32  , unsigned char * );   370                                   int32  , unsigned char * );
371 typedef void (*tileSeparateRoutine)(TIFFRGBAImage * , uint32 * , uint32  ,   371 typedef void (*tileSeparateRoutine)(TIFFRGBAImage * , uint32 * , uint32  ,
372                                     uint32  , uint32  , uint32  , int32  ,   372                                     uint32  , uint32  , uint32  , int32  ,
373                                     int32  , unsigned char * , unsigned char * ,   373                                     int32  , unsigned char * , unsigned char * ,
374                                     unsigned char * , unsigned char * );   374                                     unsigned char * , unsigned char * );
375 union __anonunion_put_25 {   375 union __anonunion_put_25 {
376    void (*any)(TIFFRGBAImage * ) ;   376    void (*any)(TIFFRGBAImage * ) ;
377    void (*contig)(TIFFRGBAImage * , uint32 * , uint32  , uint32  , uint32  ,   377    void (*contig)(TIFFRGBAImage * , uint32 * , uint32  , uint32  , uint32  ,
378                   uint32  , int32  , int32  , unsigned char * ) ;   378                   uint32  , int32  , int32  , unsigned char * ) ;
379    void (*separate)(TIFFRGBAImage * , uint32 * , uint32  , uint32  , uint32  ,   379    void (*separate)(TIFFRGBAImage * , uint32 * , uint32  , uint32  , uint32  ,
380                     uint32  , int32  , int32  , unsigned char * ,   380                     uint32  , int32  , int32  , unsigned char * ,
381                     unsigned char * , unsigned char * , unsigned char * ) ;   381                     unsigned char * , unsigned char * , unsigned char * ) ;
382 };   382 };
383 struct _TIFFRGBAImage {   383 struct _TIFFRGBAImage {
384    TIFF *tif ;   384    TIFF *tif ;
385    int stoponerr ;   385    int stoponerr ;
386    int isContig ;   386    int isContig ;
387    int alpha ;   387    int alpha ;
388    uint32 width ;   388    uint32 width ;
389    uint32 height ;   389    uint32 height ;
390    uint16 bitspersample ;   390    uint16 bitspersample ;
391    uint16 samplesperpixel ;   391    uint16 samplesperpixel ;
392    uint16 orientation ;   392    uint16 orientation ;
393    uint16 req_orientation ;   393    uint16 req_orientation ;
394    uint16 photometric ;   394    uint16 photometric ;
395    uint16 *redcmap ;   395    uint16 *redcmap ;
396    uint16 *greencmap ;   396    uint16 *greencmap ;
397    uint16 *bluecmap ;   397    uint16 *bluecmap ;
398    int (*get)(TIFFRGBAImage * , uint32 * , uint32  , uint32  ) ;   398    int (*get)(TIFFRGBAImage * , uint32 * , uint32  , uint32  ) ;
399    union __anonunion_put_25 put ;   399    union __anonunion_put_25 put ;
400    TIFFRGBValue *Map ;   400    TIFFRGBValue *Map ;
401    uint32 **BWmap ;   401    uint32 **BWmap ;
402    uint32 **PALmap ;   402    uint32 **PALmap ;
403    TIFFYCbCrToRGB *ycbcr ;   403    TIFFYCbCrToRGB *ycbcr ;
404    TIFFCIELabToRGB *cielab ;   404    TIFFCIELabToRGB *cielab ;
405    uint8 *UaToAa ;   405    uint8 *UaToAa ;
406    uint8 *Bitdepth16To8 ;   406    uint8 *Bitdepth16To8 ;
407    int row_offset ;   407    int row_offset ;
408    int col_offset ;   408    int col_offset ;
409 };   409 };
410 typedef int (*TIFFInitMethod)(TIFF * , int  );   410 typedef int (*TIFFInitMethod)(TIFF * , int  );
411 struct __anonstruct_TIFFCodec_26 {   411 struct __anonstruct_TIFFCodec_26 {
412    char *name ;   412    char *name ;
413    uint16 scheme ;   413    uint16 scheme ;
414    int (*init)(TIFF * , int  ) ;   414    int (*init)(TIFF * , int  ) ;
415 };   415 };
416 typedef struct __anonstruct_TIFFCodec_26 TIFFCodec;   416 typedef struct __anonstruct_TIFFCodec_26 TIFFCodec;
417 struct _IO_FILE;   417 struct _IO_FILE;
418 struct _IO_FILE;   418 struct _IO_FILE;
419 typedef struct _IO_FILE FILE;   419 typedef struct _IO_FILE FILE;
420 typedef struct _IO_FILE __FILE;   420 typedef struct _IO_FILE __FILE;
421 union __anonunion___value_28 {   421 union __anonunion___value_28 {
422    unsigned int __wch ;   422    unsigned int __wch ;
423    char __wchb[4] ;   423    char __wchb[4] ;
424 };   424 };
425 struct __anonstruct___mbstate_t_27 {   425 struct __anonstruct___mbstate_t_27 {
426    int __count ;   426    int __count ;
427    union __anonunion___value_28 __value ;   427    union __anonunion___value_28 __value ;
428 };   428 };
429 typedef struct __anonstruct___mbstate_t_27 __mbstate_t;   429 typedef struct __anonstruct___mbstate_t_27 __mbstate_t;
430 struct __anonstruct__G_fpos_t_29 {   430 struct __anonstruct__G_fpos_t_29 {
431    __off_t __pos ;   431    __off_t __pos ;
432    __mbstate_t __state ;   432    __mbstate_t __state ;
433 };   433 };
434 typedef struct __anonstruct__G_fpos_t_29 _G_fpos_t;   434 typedef struct __anonstruct__G_fpos_t_29 _G_fpos_t;
435 struct __anonstruct__G_fpos64_t_30 {   435 struct __anonstruct__G_fpos64_t_30 {
436    __off64_t __pos ;   436    __off64_t __pos ;
437    __mbstate_t __state ;   437    __mbstate_t __state ;
438 };   438 };
439 typedef struct __anonstruct__G_fpos64_t_30 _G_fpos64_t;   439 typedef struct __anonstruct__G_fpos64_t_30 _G_fpos64_t;
440 typedef short _G_int16_t;   440 typedef short _G_int16_t;
441 typedef int _G_int32_t;   441 typedef int _G_int32_t;
442 typedef unsigned short _G_uint16_t;   442 typedef unsigned short _G_uint16_t;
443 typedef unsigned int _G_uint32_t;   443 typedef unsigned int _G_uint32_t;
444 typedef __builtin_va_list __gnuc_va_list;   444 typedef __builtin_va_list __gnuc_va_list;
445 struct _IO_jump_t;   445 struct _IO_jump_t;
446 struct _IO_jump_t;   446 struct _IO_jump_t;
447 struct _IO_FILE;   447 struct _IO_FILE;
448 typedef void _IO_lock_t;   448 typedef void _IO_lock_t;
449 struct _IO_marker {   449 struct _IO_marker {
450    struct _IO_marker *_next ;   450    struct _IO_marker *_next ;
451    struct _IO_FILE *_sbuf ;   451    struct _IO_FILE *_sbuf ;
452    int _pos ;   452    int _pos ;
453 };   453 };
454 enum __codecvt_result {   454 enum __codecvt_result {
455     __codecvt_ok = 0,   455     __codecvt_ok = 0,
456     __codecvt_partial = 1,   456     __codecvt_partial = 1,
457     __codecvt_error = 2,   457     __codecvt_error = 2,
458     __codecvt_noconv = 3   458     __codecvt_noconv = 3
459 } ;   459 } ;
460 struct _IO_FILE {   460 struct _IO_FILE {
461    int _flags ;   461    int _flags ;
462    char *_IO_read_ptr ;   462    char *_IO_read_ptr ;
463    char *_IO_read_end ;   463    char *_IO_read_end ;
464    char *_IO_read_base ;   464    char *_IO_read_base ;
465    char *_IO_write_base ;   465    char *_IO_write_base ;
466    char *_IO_write_ptr ;   466    char *_IO_write_ptr ;
467    char *_IO_write_end ;   467    char *_IO_write_end ;
468    char *_IO_buf_base ;   468    char *_IO_buf_base ;
469    char *_IO_buf_end ;   469    char *_IO_buf_end ;
470    char *_IO_save_base ;   470    char *_IO_save_base ;
471    char *_IO_backup_base ;   471    char *_IO_backup_base ;
472    char *_IO_save_end ;   472    char *_IO_save_end ;
473    struct _IO_marker *_markers ;   473    struct _IO_marker *_markers ;
474    struct _IO_FILE *_chain ;   474    struct _IO_FILE *_chain ;
475    int _fileno ;   475    int _fileno ;
476    int _flags2 ;   476    int _flags2 ;
477    __off_t _old_offset ;   477    __off_t _old_offset ;
478    unsigned short _cur_column ;   478    unsigned short _cur_column ;
479    signed char _vtable_offset ;   479    signed char _vtable_offset ;
480    char _shortbuf[1] ;   480    char _shortbuf[1] ;
481    _IO_lock_t *_lock ;   481    _IO_lock_t *_lock ;
482    __off64_t _offset ;   482    __off64_t _offset ;
483    void *__pad1 ;   483    void *__pad1 ;
484    void *__pad2 ;   484    void *__pad2 ;
485    void *__pad3 ;   485    void *__pad3 ;
486    void *__pad4 ;   486    void *__pad4 ;
487    size_t __pad5 ;   487    size_t __pad5 ;
488    int _mode ;   488    int _mode ;
489    char _unused2[(15U * sizeof(int ) - 4U * sizeof(void *)) - sizeof(size_t )] ;   489    char _unused2[(15U * sizeof(int ) - 4U * sizeof(void *)) - sizeof(size_t )] ;
490 };   490 };
491 typedef struct _IO_FILE _IO_FILE;   491 typedef struct _IO_FILE _IO_FILE;
492 struct _IO_FILE_plus;   492 struct _IO_FILE_plus;
493 struct _IO_FILE_plus;   493 struct _IO_FILE_plus;
494 typedef __ssize_t __io_read_fn(void *__cookie , char *__buf , size_t __nbytes );   494 typedef __ssize_t __io_read_fn(void *__cookie , char *__buf , size_t __nbytes );
495 typedef __ssize_t __io_write_fn(void *__cookie , char const   *__buf ,   495 typedef __ssize_t __io_write_fn(void *__cookie , char const   *__buf ,
496                                 size_t __n );   496                                 size_t __n );
497 typedef int __io_seek_fn(void *__cookie , __off64_t *__pos , int __w );   497 typedef int __io_seek_fn(void *__cookie , __off64_t *__pos , int __w );
498 typedef int __io_close_fn(void *__cookie );   498 typedef int __io_close_fn(void *__cookie );
499 typedef __gnuc_va_list va_list;   499 typedef __gnuc_va_list va_list;
500 typedef _G_fpos64_t fpos_t;   500 typedef _G_fpos64_t fpos_t;
501 typedef void (*TIFFErrorHandler)(char const   * , char const   * , va_list  );   501 typedef void (*TIFFErrorHandler)(char const   * , char const   * , va_list  );
502 typedef void (*TIFFErrorHandlerExt)(thandle_t  , char const   * ,   502 typedef void (*TIFFErrorHandlerExt)(thandle_t  , char const   * ,
503                                     char const   * , va_list  );   503                                     char const   * , va_list  );
504 typedef tmsize_t (*TIFFReadWriteProc)(thandle_t  , void * , tmsize_t  );   504 typedef tmsize_t (*TIFFReadWriteProc)(thandle_t  , void * , tmsize_t  );
505 typedef toff_t (*TIFFSeekProc)(thandle_t  , toff_t  , int  );   505 typedef toff_t (*TIFFSeekProc)(thandle_t  , toff_t  , int  );
506 typedef int (*TIFFCloseProc)(thandle_t  );   506 typedef int (*TIFFCloseProc)(thandle_t  );
507 typedef toff_t (*TIFFSizeProc)(thandle_t  );   507 typedef toff_t (*TIFFSizeProc)(thandle_t  );
508 typedef int (*TIFFMapFileProc)(thandle_t  , void **base , toff_t *size );   508 typedef int (*TIFFMapFileProc)(thandle_t  , void **base , toff_t *size );
509 typedef void (*TIFFUnmapFileProc)(thandle_t  , void *base , toff_t size );   509 typedef void (*TIFFUnmapFileProc)(thandle_t  , void *base , toff_t size );
510 typedef void (*TIFFExtendProc)(TIFF * );   510 typedef void (*TIFFExtendProc)(TIFF * );
511 struct _TIFFField;   511 struct _TIFFField;
512 typedef struct _TIFFField TIFFField;   512 typedef struct _TIFFField TIFFField;
513 struct _TIFFFieldArray;   513 struct _TIFFFieldArray;
514 typedef struct _TIFFFieldArray TIFFFieldArray;   514 typedef struct _TIFFFieldArray TIFFFieldArray;
515 typedef int (*TIFFVSetMethod)(TIFF * , uint32  , va_list  );   515 typedef int (*TIFFVSetMethod)(TIFF * , uint32  , va_list  );
516 typedef int (*TIFFVGetMethod)(TIFF * , uint32  , va_list  );   516 typedef int (*TIFFVGetMethod)(TIFF * , uint32  , va_list  );
517 typedef void (*TIFFPrintMethod)(TIFF * , FILE * , long  );   517 typedef void (*TIFFPrintMethod)(TIFF * , FILE * , long  );
518 struct __anonstruct_TIFFTagMethods_31 {   518 struct __anonstruct_TIFFTagMethods_31 {
519    int (*vsetfield)(TIFF * , uint32  , va_list  ) ;   519    int (*vsetfield)(TIFF * , uint32  , va_list  ) ;
520    int (*vgetfield)(TIFF * , uint32  , va_list  ) ;   520    int (*vgetfield)(TIFF * , uint32  , va_list  ) ;
521    void (*printdir)(TIFF * , FILE * , long  ) ;   521    void (*printdir)(TIFF * , FILE * , long  ) ;
522 };   522 };
523 typedef struct __anonstruct_TIFFTagMethods_31 TIFFTagMethods;   523 typedef struct __anonstruct_TIFFTagMethods_31 TIFFTagMethods;
524 struct __anonstruct_TIFFFieldInfo_32 {   524 struct __anonstruct_TIFFFieldInfo_32 {
525    ttag_t field_tag ;   525    ttag_t field_tag ;
526    short field_readcount ;   526    short field_readcount ;
527    short field_writecount ;   527    short field_writecount ;
528    TIFFDataType field_type ;   528    TIFFDataType field_type ;
529    unsigned short field_bit ;   529    unsigned short field_bit ;
530    unsigned char field_oktochange ;   530    unsigned char field_oktochange ;
531    unsigned char field_passcount ;   531    unsigned char field_passcount ;
532    char *field_name ;   532    char *field_name ;
533 };   533 };
534 typedef struct __anonstruct_TIFFFieldInfo_32 TIFFFieldInfo;   534 typedef struct __anonstruct_TIFFFieldInfo_32 TIFFFieldInfo;
535 struct __anonstruct_TIFFTagValue_33 {   535 struct __anonstruct_TIFFTagValue_33 {
536    TIFFField const   *info ;   536    TIFFField const   *info ;
537    int count ;   537    int count ;
538    void *value ;   538    void *value ;
539 };   539 };
540 typedef struct __anonstruct_TIFFTagValue_33 TIFFTagValue;   540 typedef struct __anonstruct_TIFFTagValue_33 TIFFTagValue;
541 struct __anonstruct_TIFFDirectory_34 {   541 struct __anonstruct_TIFFDirectory_34 {
542    unsigned long td_fieldsset[4] ;   542    unsigned long td_fieldsset[4] ;
543    uint32 td_imagewidth ;   543    uint32 td_imagewidth ;
544    uint32 td_imagelength ;   544    uint32 td_imagelength ;
545    uint32 td_imagedepth ;   545    uint32 td_imagedepth ;
546    uint32 td_tilewidth ;   546    uint32 td_tilewidth ;
547    uint32 td_tilelength ;   547    uint32 td_tilelength ;
548    uint32 td_tiledepth ;   548    uint32 td_tiledepth ;
549    uint32 td_subfiletype ;   549    uint32 td_subfiletype ;
550    uint16 td_bitspersample ;   550    uint16 td_bitspersample ;
551    uint16 td_sampleformat ;   551    uint16 td_sampleformat ;
552    uint16 td_compression ;   552    uint16 td_compression ;
553    uint16 td_photometric ;   553    uint16 td_photometric ;
554    uint16 td_threshholding ;   554    uint16 td_threshholding ;
555    uint16 td_fillorder ;   555    uint16 td_fillorder ;
556    uint16 td_orientation ;   556    uint16 td_orientation ;
557    uint16 td_samplesperpixel ;   557    uint16 td_samplesperpixel ;
558    uint32 td_rowsperstrip ;   558    uint32 td_rowsperstrip ;
559    uint16 td_minsamplevalue ;   559    uint16 td_minsamplevalue ;
560    uint16 td_maxsamplevalue ;   560    uint16 td_maxsamplevalue ;
561    double td_sminsamplevalue ;   561    double td_sminsamplevalue ;
562    double td_smaxsamplevalue ;   562    double td_smaxsamplevalue ;
563    float td_xresolution ;   563    float td_xresolution ;
564    float td_yresolution ;   564    float td_yresolution ;
565    uint16 td_resolutionunit ;   565    uint16 td_resolutionunit ;
566    uint16 td_planarconfig ;   566    uint16 td_planarconfig ;
567    float td_xposition ;   567    float td_xposition ;
568    float td_yposition ;   568    float td_yposition ;
569    uint16 td_pagenumber[2] ;   569    uint16 td_pagenumber[2] ;
570    uint16 *td_colormap[3] ;   570    uint16 *td_colormap[3] ;
571    uint16 td_halftonehints[2] ;   571    uint16 td_halftonehints[2] ;
572    uint16 td_extrasamples ;   572    uint16 td_extrasamples ;
573    uint16 *td_sampleinfo ;   573    uint16 *td_sampleinfo ;
574    uint32 td_stripsperimage ;   574    uint32 td_stripsperimage ;
575    uint32 td_nstrips ;   575    uint32 td_nstrips ;
576    uint64 *td_stripoffset ;   576    uint64 *td_stripoffset ;
577    uint64 *td_stripbytecount ;   577    uint64 *td_stripbytecount ;
578    int td_stripbytecountsorted ;   578    int td_stripbytecountsorted ;
579    uint16 td_nsubifd ;   579    uint16 td_nsubifd ;
580    uint64 *td_subifd ;   580    uint64 *td_subifd ;
581    uint16 td_ycbcrsubsampling[2] ;   581    uint16 td_ycbcrsubsampling[2] ;
582    uint16 td_ycbcrpositioning ;   582    uint16 td_ycbcrpositioning ;
583    uint16 *td_transferfunction[3] ;   583    uint16 *td_transferfunction[3] ;
584    int td_inknameslen ;   584    int td_inknameslen ;
585    char *td_inknames ;   585    char *td_inknames ;
586    int td_customValueCount ;   586    int td_customValueCount ;
587    TIFFTagValue *td_customValues ;   587    TIFFTagValue *td_customValues ;
588 };   588 };
589 typedef struct __anonstruct_TIFFDirectory_34 TIFFDirectory;   589 typedef struct __anonstruct_TIFFDirectory_34 TIFFDirectory;
590 enum __anonenum_TIFFSetGetFieldType_35 {   590 enum __anonenum_TIFFSetGetFieldType_35 {
591     TIFF_SETGET_UNDEFINED = 0,   591     TIFF_SETGET_UNDEFINED = 0,
592     TIFF_SETGET_ASCII = 1,   592     TIFF_SETGET_ASCII = 1,
593     TIFF_SETGET_UINT8 = 2,   593     TIFF_SETGET_UINT8 = 2,
594     TIFF_SETGET_SINT8 = 3,   594     TIFF_SETGET_SINT8 = 3,
595     TIFF_SETGET_UINT16 = 4,   595     TIFF_SETGET_UINT16 = 4,
596     TIFF_SETGET_SINT16 = 5,   596     TIFF_SETGET_SINT16 = 5,
597     TIFF_SETGET_UINT32 = 6,   597     TIFF_SETGET_UINT32 = 6,
598     TIFF_SETGET_SINT32 = 7,   598     TIFF_SETGET_SINT32 = 7,
599     TIFF_SETGET_UINT64 = 8,   599     TIFF_SETGET_UINT64 = 8,
600     TIFF_SETGET_SINT64 = 9,   600     TIFF_SETGET_SINT64 = 9,
601     TIFF_SETGET_FLOAT = 10,   601     TIFF_SETGET_FLOAT = 10,
602     TIFF_SETGET_DOUBLE = 11,   602     TIFF_SETGET_DOUBLE = 11,
603     TIFF_SETGET_IFD8 = 12,   603     TIFF_SETGET_IFD8 = 12,
604     TIFF_SETGET_INT = 13,   604     TIFF_SETGET_INT = 13,
605     TIFF_SETGET_UINT16_PAIR = 14,   605     TIFF_SETGET_UINT16_PAIR = 14,
606     TIFF_SETGET_C0_ASCII = 15,   606     TIFF_SETGET_C0_ASCII = 15,
607     TIFF_SETGET_C0_UINT8 = 16,   607     TIFF_SETGET_C0_UINT8 = 16,
608     TIFF_SETGET_C0_SINT8 = 17,   608     TIFF_SETGET_C0_SINT8 = 17,
609     TIFF_SETGET_C0_UINT16 = 18,   609     TIFF_SETGET_C0_UINT16 = 18,
610     TIFF_SETGET_C0_SINT16 = 19,   610     TIFF_SETGET_C0_SINT16 = 19,
611     TIFF_SETGET_C0_UINT32 = 20,   611     TIFF_SETGET_C0_UINT32 = 20,
612     TIFF_SETGET_C0_SINT32 = 21,   612     TIFF_SETGET_C0_SINT32 = 21,
613     TIFF_SETGET_C0_UINT64 = 22,   613     TIFF_SETGET_C0_UINT64 = 22,
614     TIFF_SETGET_C0_SINT64 = 23,   614     TIFF_SETGET_C0_SINT64 = 23,
615     TIFF_SETGET_C0_FLOAT = 24,   615     TIFF_SETGET_C0_FLOAT = 24,
616     TIFF_SETGET_C0_DOUBLE = 25,   616     TIFF_SETGET_C0_DOUBLE = 25,
617     TIFF_SETGET_C0_IFD8 = 26,   617     TIFF_SETGET_C0_IFD8 = 26,
618     TIFF_SETGET_C16_ASCII = 27,   618     TIFF_SETGET_C16_ASCII = 27,
619     TIFF_SETGET_C16_UINT8 = 28,   619     TIFF_SETGET_C16_UINT8 = 28,
620     TIFF_SETGET_C16_SINT8 = 29,   620     TIFF_SETGET_C16_SINT8 = 29,
621     TIFF_SETGET_C16_UINT16 = 30,   621     TIFF_SETGET_C16_UINT16 = 30,
622     TIFF_SETGET_C16_SINT16 = 31,   622     TIFF_SETGET_C16_SINT16 = 31,
623     TIFF_SETGET_C16_UINT32 = 32,   623     TIFF_SETGET_C16_UINT32 = 32,
624     TIFF_SETGET_C16_SINT32 = 33,   624     TIFF_SETGET_C16_SINT32 = 33,
625     TIFF_SETGET_C16_UINT64 = 34,   625     TIFF_SETGET_C16_UINT64 = 34,
626     TIFF_SETGET_C16_SINT64 = 35,   626     TIFF_SETGET_C16_SINT64 = 35,
627     TIFF_SETGET_C16_FLOAT = 36,   627     TIFF_SETGET_C16_FLOAT = 36,
628     TIFF_SETGET_C16_DOUBLE = 37,   628     TIFF_SETGET_C16_DOUBLE = 37,
629     TIFF_SETGET_C16_IFD8 = 38,   629     TIFF_SETGET_C16_IFD8 = 38,
630     TIFF_SETGET_C32_ASCII = 39,   630     TIFF_SETGET_C32_ASCII = 39,
631     TIFF_SETGET_C32_UINT8 = 40,   631     TIFF_SETGET_C32_UINT8 = 40,
632     TIFF_SETGET_C32_SINT8 = 41,   632     TIFF_SETGET_C32_SINT8 = 41,
633     TIFF_SETGET_C32_UINT16 = 42,   633     TIFF_SETGET_C32_UINT16 = 42,
634     TIFF_SETGET_C32_SINT16 = 43,   634     TIFF_SETGET_C32_SINT16 = 43,
635     TIFF_SETGET_C32_UINT32 = 44,   635     TIFF_SETGET_C32_UINT32 = 44,
636     TIFF_SETGET_C32_SINT32 = 45,   636     TIFF_SETGET_C32_SINT32 = 45,
637     TIFF_SETGET_C32_UINT64 = 46,   637     TIFF_SETGET_C32_UINT64 = 46,
638     TIFF_SETGET_C32_SINT64 = 47,   638     TIFF_SETGET_C32_SINT64 = 47,
639     TIFF_SETGET_C32_FLOAT = 48,   639     TIFF_SETGET_C32_FLOAT = 48,
640     TIFF_SETGET_C32_DOUBLE = 49,   640     TIFF_SETGET_C32_DOUBLE = 49,
641     TIFF_SETGET_C32_IFD8 = 50,   641     TIFF_SETGET_C32_IFD8 = 50,
642     TIFF_SETGET_OTHER = 51   642     TIFF_SETGET_OTHER = 51
643 } ;   643 } ;
644 typedef enum __anonenum_TIFFSetGetFieldType_35 TIFFSetGetFieldType;   644 typedef enum __anonenum_TIFFSetGetFieldType_35 TIFFSetGetFieldType;
645 enum __anonenum_TIFFFieldArrayType_36 {   645 enum __anonenum_TIFFFieldArrayType_36 {
646     tfiatImage = 0,   646     tfiatImage = 0,
647     tfiatExif = 1,   647     tfiatExif = 1,
648     tfiatOther = 2   648     tfiatOther = 2
649 } ;   649 } ;
650 typedef enum __anonenum_TIFFFieldArrayType_36 TIFFFieldArrayType;   650 typedef enum __anonenum_TIFFFieldArrayType_36 TIFFFieldArrayType;
651 struct _TIFFFieldArray {   651 struct _TIFFFieldArray {
652    TIFFFieldArrayType type ;   652    TIFFFieldArrayType type ;
653    uint32 allocated_size ;   653    uint32 allocated_size ;
654    uint32 count ;   654    uint32 count ;
655    TIFFField *fields ;   655    TIFFField *fields ;
656 };   656 };
657 struct _TIFFField {   657 struct _TIFFField {
658    uint32 field_tag ;   658    uint32 field_tag ;
659    short field_readcount ;   659    short field_readcount ;
660    short field_writecount ;   660    short field_writecount ;
661    TIFFDataType field_type ;   661    TIFFDataType field_type ;
662    uint32 reserved ;   662    uint32 reserved ;
663    TIFFSetGetFieldType set_field_type ;   663    TIFFSetGetFieldType set_field_type ;
664    TIFFSetGetFieldType get_field_type ;   664    TIFFSetGetFieldType get_field_type ;
665    unsigned short field_bit ;   665    unsigned short field_bit ;
666    unsigned char field_oktochange ;   666    unsigned char field_oktochange ;
667    unsigned char field_passcount ;   667    unsigned char field_passcount ;
668    char *field_name ;   668    char *field_name ;
669    TIFFFieldArray *field_subfields ;   669    TIFFFieldArray *field_subfields ;
670 };   670 };
671 union __anonunion_tdir_offset_38 {   671 union __anonunion_tdir_offset_38 {
672    uint16 toff_short ;   672    uint16 toff_short ;
673    uint32 toff_long ;   673    uint32 toff_long ;
674    uint64 toff_long8 ;   674    uint64 toff_long8 ;
675 };   675 };
676 struct __anonstruct_TIFFDirEntry_37 {   676 struct __anonstruct_TIFFDirEntry_37 {
677    uint16 tdir_tag ;   677    uint16 tdir_tag ;
678    uint16 tdir_type ;   678    uint16 tdir_type ;
679    uint64 tdir_count ;   679    uint64 tdir_count ;
680    union __anonunion_tdir_offset_38 tdir_offset ;   680    union __anonunion_tdir_offset_38 tdir_offset ;
681 };   681 };
682 typedef struct __anonstruct_TIFFDirEntry_37 TIFFDirEntry;   682 typedef struct __anonstruct_TIFFDirEntry_37 TIFFDirEntry;
683 struct client_info {   683 struct client_info {
684    struct client_info *next ;   684    struct client_info *next ;
685    void *data ;   685    void *data ;
686    char *name ;   686    char *name ;
687 };   687 };
688 typedef struct client_info TIFFClientInfoLink;   688 typedef struct client_info TIFFClientInfoLink;
689 typedef unsigned char tidataval_t;   689 typedef unsigned char tidataval_t;
690 typedef tidataval_t *tidata_t;   690 typedef tidataval_t *tidata_t;
691 typedef void (*TIFFVoidMethod)(TIFF * );   691 typedef void (*TIFFVoidMethod)(TIFF * );
692 typedef int (*TIFFBoolMethod)(TIFF * );   692 typedef int (*TIFFBoolMethod)(TIFF * );
693 typedef int (*TIFFPreMethod)(TIFF * , uint16  );   693 typedef int (*TIFFPreMethod)(TIFF * , uint16  );
694 typedef int (*TIFFCodeMethod)(TIFF *tif , uint8 *buf , tmsize_t size ,   694 typedef int (*TIFFCodeMethod)(TIFF *tif , uint8 *buf , tmsize_t size ,
695                               uint16 sample );   695                               uint16 sample );
696 typedef int (*TIFFSeekMethod)(TIFF * , uint32  );   696 typedef int (*TIFFSeekMethod)(TIFF * , uint32  );
697 typedef void (*TIFFPostMethod)(TIFF *tif , uint8 *buf , tmsize_t size );   697 typedef void (*TIFFPostMethod)(TIFF *tif , uint8 *buf , tmsize_t size );
698 typedef uint32 (*TIFFStripMethod)(TIFF * , uint32  );   698 typedef uint32 (*TIFFStripMethod)(TIFF * , uint32  );
699 typedef void (*TIFFTileMethod)(TIFF * , uint32 * , uint32 * );   699 typedef void (*TIFFTileMethod)(TIFF * , uint32 * , uint32 * );
700 union __anonunion_tif_header_39 {   700 union __anonunion_tif_header_39 {
701    TIFFHeaderCommon common ;   701    TIFFHeaderCommon common ;
702    TIFFHeaderClassic classic ;   702    TIFFHeaderClassic classic ;
703    TIFFHeaderBig big ;   703    TIFFHeaderBig big ;
704 };   704 };
705 struct tiff {   705 struct tiff {
706    char *tif_name ;   706    char *tif_name ;
707    int tif_fd ;   707    int tif_fd ;
708    int tif_mode ;   708    int tif_mode ;
709    uint32 tif_flags ;   709    uint32 tif_flags ;
710    uint64 tif_diroff ;   710    uint64 tif_diroff ;
711    uint64 tif_nextdiroff ;   711    uint64 tif_nextdiroff ;
712    uint64 *tif_dirlist ;   712    uint64 *tif_dirlist ;
713    uint16 tif_dirlistsize ;   713    uint16 tif_dirlistsize ;
714    uint16 tif_dirnumber ;   714    uint16 tif_dirnumber ;
715    TIFFDirectory tif_dir ;   715    TIFFDirectory tif_dir ;
716    TIFFDirectory tif_customdir ;   716    TIFFDirectory tif_customdir ;
717    union __anonunion_tif_header_39 tif_header ;   717    union __anonunion_tif_header_39 tif_header ;
718    uint16 tif_header_size ;   718    uint16 tif_header_size ;
719    uint32 tif_row ;   719    uint32 tif_row ;
720    uint16 tif_curdir ;   720    uint16 tif_curdir ;
721    uint32 tif_curstrip ;   721    uint32 tif_curstrip ;
722    uint64 tif_curoff ;   722    uint64 tif_curoff ;
723    uint64 tif_dataoff ;   723    uint64 tif_dataoff ;
724    uint16 tif_nsubifd ;   724    uint16 tif_nsubifd ;
725    uint64 tif_subifdoff ;   725    uint64 tif_subifdoff ;
726    uint32 tif_col ;   726    uint32 tif_col ;
727    uint32 tif_curtile ;   727    uint32 tif_curtile ;
728    tmsize_t tif_tilesize ;   728    tmsize_t tif_tilesize ;
729    int tif_decodestatus ;   729    int tif_decodestatus ;
730    int (*tif_fixuptags)(TIFF * ) ;   730    int (*tif_fixuptags)(TIFF * ) ;
731    int (*tif_setupdecode)(TIFF * ) ;   731    int (*tif_setupdecode)(TIFF * ) ;
732    int (*tif_predecode)(TIFF * , uint16  ) ;   732    int (*tif_predecode)(TIFF * , uint16  ) ;
733    int (*tif_setupencode)(TIFF * ) ;   733    int (*tif_setupencode)(TIFF * ) ;
734    int tif_encodestatus ;   734    int tif_encodestatus ;
735    int (*tif_preencode)(TIFF * , uint16  ) ;   735    int (*tif_preencode)(TIFF * , uint16  ) ;
736    int (*tif_postencode)(TIFF * ) ;   736    int (*tif_postencode)(TIFF * ) ;
737    int (*tif_decoderow)(TIFF *tif , uint8 *buf , tmsize_t size , uint16 sample ) ;   737    int (*tif_decoderow)(TIFF *tif , uint8 *buf , tmsize_t size , uint16 sample ) ;
738    int (*tif_encoderow)(TIFF *tif , uint8 *buf , tmsize_t size , uint16 sample ) ;   738    int (*tif_encoderow)(TIFF *tif , uint8 *buf , tmsize_t size , uint16 sample ) ;
739    int (*tif_decodestrip)(TIFF *tif , uint8 *buf , tmsize_t size ,   739    int (*tif_decodestrip)(TIFF *tif , uint8 *buf , tmsize_t size ,
740                           uint16 sample ) ;   740                           uint16 sample ) ;
741    int (*tif_encodestrip)(TIFF *tif , uint8 *buf , tmsize_t size ,   741    int (*tif_encodestrip)(TIFF *tif , uint8 *buf , tmsize_t size ,
742                           uint16 sample ) ;   742                           uint16 sample ) ;
743    int (*tif_decodetile)(TIFF *tif , uint8 *buf , tmsize_t size , uint16 sample ) ;   743    int (*tif_decodetile)(TIFF *tif , uint8 *buf , tmsize_t size , uint16 sample ) ;
744    int (*tif_encodetile)(TIFF *tif , uint8 *buf , tmsize_t size , uint16 sample ) ;   744    int (*tif_encodetile)(TIFF *tif , uint8 *buf , tmsize_t size , uint16 sample ) ;
745    void (*tif_close)(TIFF * ) ;   745    void (*tif_close)(TIFF * ) ;
746    int (*tif_seek)(TIFF * , uint32  ) ;   746    int (*tif_seek)(TIFF * , uint32  ) ;
747    void (*tif_cleanup)(TIFF * ) ;   747    void (*tif_cleanup)(TIFF * ) ;
748    uint32 (*tif_defstripsize)(TIFF * , uint32  ) ;   748    uint32 (*tif_defstripsize)(TIFF * , uint32  ) ;
749    void (*tif_deftilesize)(TIFF * , uint32 * , uint32 * ) ;   749    void (*tif_deftilesize)(TIFF * , uint32 * , uint32 * ) ;
750    uint8 *tif_data ;   750    uint8 *tif_data ;
751    tmsize_t tif_scanlinesize ;   751    tmsize_t tif_scanlinesize ;
752    tmsize_t tif_scanlineskew ;   752    tmsize_t tif_scanlineskew ;
753    uint8 *tif_rawdata ;   753    uint8 *tif_rawdata ;
754    tmsize_t tif_rawdatasize ;   754    tmsize_t tif_rawdatasize ;
755    uint8 *tif_rawcp ;   755    uint8 *tif_rawcp ;
756    tmsize_t tif_rawcc ;   756    tmsize_t tif_rawcc ;
757    uint8 *tif_base ;   757    uint8 *tif_base ;
758    tmsize_t tif_size ;   758    tmsize_t tif_size ;
759    int (*tif_mapproc)(thandle_t  , void **base , toff_t *size ) ;   759    int (*tif_mapproc)(thandle_t  , void **base , toff_t *size ) ;
760    void (*tif_unmapproc)(thandle_t  , void *base , toff_t size ) ;   760    void (*tif_unmapproc)(thandle_t  , void *base , toff_t size ) ;
761    thandle_t tif_clientdata ;   761    thandle_t tif_clientdata ;
762    tmsize_t (*tif_readproc)(thandle_t  , void * , tmsize_t  ) ;   762    tmsize_t (*tif_readproc)(thandle_t  , void * , tmsize_t  ) ;
763    tmsize_t (*tif_writeproc)(thandle_t  , void * , tmsize_t  ) ;   763    tmsize_t (*tif_writeproc)(thandle_t  , void * , tmsize_t  ) ;
764    toff_t (*tif_seekproc)(thandle_t  , toff_t  , int  ) ;   764    toff_t (*tif_seekproc)(thandle_t  , toff_t  , int  ) ;
765    int (*tif_closeproc)(thandle_t  ) ;   765    int (*tif_closeproc)(thandle_t  ) ;
766    toff_t (*tif_sizeproc)(thandle_t  ) ;   766    toff_t (*tif_sizeproc)(thandle_t  ) ;
767    void (*tif_postdecode)(TIFF *tif , uint8 *buf , tmsize_t size ) ;   767    void (*tif_postdecode)(TIFF *tif , uint8 *buf , tmsize_t size ) ;
768    TIFFField **tif_fields ;   768    TIFFField **tif_fields ;
769    size_t tif_nfields ;   769    size_t tif_nfields ;
770    TIFFField const   *tif_foundfield ;   770    TIFFField const   *tif_foundfield ;
771    TIFFTagMethods tif_tagmethods ;   771    TIFFTagMethods tif_tagmethods ;
772    TIFFClientInfoLink *tif_clientinfo ;   772    TIFFClientInfoLink *tif_clientinfo ;
773    TIFFFieldArray *tif_fieldscompat ;   773    TIFFFieldArray *tif_fieldscompat ;
774    size_t tif_nfieldscompat ;   774    size_t tif_nfieldscompat ;
775 };   775 };
776 typedef long wchar_t;   776 typedef long wchar_t;
777 struct __anonstruct___wait_terminated_40 {   777 struct __anonstruct___wait_terminated_40 {
778    unsigned int __w_termsig : 7 ;   778    unsigned int __w_termsig : 7 ;
779    unsigned int __w_coredump : 1 ;   779    unsigned int __w_coredump : 1 ;
780    unsigned int __w_retcode : 8 ;   780    unsigned int __w_retcode : 8 ;
781    unsigned int  : 16 ;   781    unsigned int  : 16 ;
782 };   782 };
783 struct __anonstruct___wait_stopped_41 {   783 struct __anonstruct___wait_stopped_41 {
784    unsigned int __w_stopval : 8 ;   784    unsigned int __w_stopval : 8 ;
785    unsigned int __w_stopsig : 8 ;   785    unsigned int __w_stopsig : 8 ;
786    unsigned int  : 16 ;   786    unsigned int  : 16 ;
787 };   787 };
788 union wait {   788 union wait {
789    int w_status ;   789    int w_status ;
790    struct __anonstruct___wait_terminated_40 __wait_terminated ;   790    struct __anonstruct___wait_terminated_40 __wait_terminated ;
791    struct __anonstruct___wait_stopped_41 __wait_stopped ;   791    struct __anonstruct___wait_stopped_41 __wait_stopped ;
792 };   792 };
793 union __anonunion___WAIT_STATUS_42 {   793 union __anonunion___WAIT_STATUS_42 {
794    union wait *__uptr ;   794    union wait *__uptr ;
795    int *__iptr ;   795    int *__iptr ;
796 };   796 };
797 typedef union __anonunion___WAIT_STATUS_42  __attribute__((__transparent_union__)) __WAIT_STATUS;   797 typedef union __anonunion___WAIT_STATUS_42  __attribute__((__transparent_union__)) __WAIT_STATUS;
798 struct __anonstruct_div_t_43 {   798 struct __anonstruct_div_t_43 {
799    int quot ;   799    int quot ;
800    int rem ;   800    int rem ;
801 };   801 };
802 typedef struct __anonstruct_div_t_43 div_t;   802 typedef struct __anonstruct_div_t_43 div_t;
803 struct __anonstruct_ldiv_t_44 {   803 struct __anonstruct_ldiv_t_44 {
804    long quot ;   804    long quot ;
805    long rem ;   805    long rem ;
806 };   806 };
807 typedef struct __anonstruct_ldiv_t_44 ldiv_t;   807 typedef struct __anonstruct_ldiv_t_44 ldiv_t;
808 struct __anonstruct_lldiv_t_45 {   808 struct __anonstruct_lldiv_t_45 {
809    long long quot ;   809    long long quot ;
810    long long rem ;   810    long long rem ;
811 };   811 };
812 typedef struct __anonstruct_lldiv_t_45 lldiv_t;   812 typedef struct __anonstruct_lldiv_t_45 lldiv_t;
813 struct random_data {   813 struct random_data {
814    int32_t *fptr ;   814    int32_t *fptr ;
815    int32_t *rptr ;   815    int32_t *rptr ;
816    int32_t *state ;   816    int32_t *state ;
817    int rand_type ;   817    int rand_type ;
818    int rand_deg ;   818    int rand_deg ;
819    int rand_sep ;   819    int rand_sep ;
820    int32_t *end_ptr ;   820    int32_t *end_ptr ;
821 };   821 };
822 struct drand48_data {   822 struct drand48_data {
823    unsigned short __x[3] ;   823    unsigned short __x[3] ;
824    unsigned short __old_x[3] ;   824    unsigned short __old_x[3] ;
825    unsigned short __c ;   825    unsigned short __c ;
826    unsigned short __init ;   826    unsigned short __init ;
827    unsigned long long __a ;   827    unsigned long long __a ;
828 };   828 };
829 typedef long double float_t;   829 typedef long double float_t;
830 typedef long double double_t;   830 typedef long double double_t;
831 enum __anonenum_46 {   831 enum __anonenum_46 {
832     FP_NAN = 0,   832     FP_NAN = 0,
833     FP_INFINITE = 1,   833     FP_INFINITE = 1,
834     FP_ZERO = 2,   834     FP_ZERO = 2,
835     FP_SUBNORMAL = 3,   835     FP_SUBNORMAL = 3,
836     FP_NORMAL = 4   836     FP_NORMAL = 4
837 } ;   837 } ;
838 enum __anonenum__LIB_VERSION_TYPE_47 {   838 enum __anonenum__LIB_VERSION_TYPE_47 {
839     _IEEE_ = -1,   839     _IEEE_ = -1,
840     _SVID_ = 0,   840     _SVID_ = 0,
841     _XOPEN_ = 1,   841     _XOPEN_ = 1,
842     _POSIX_ = 2,   842     _POSIX_ = 2,
843     _ISOC_ = 3   843     _ISOC_ = 3
844 } ;   844 } ;
845 typedef enum __anonenum__LIB_VERSION_TYPE_47 _LIB_VERSION_TYPE;   845 typedef enum __anonenum__LIB_VERSION_TYPE_47 _LIB_VERSION_TYPE;
846 struct exception {   846 struct exception {
847    int type ;   847    int type ;
848    char *name ;   848    char *name ;
849    double arg1 ;   849    double arg1 ;
850    double arg2 ;   850    double arg2 ;
851    double retval ;   851    double retval ;
852 };   852 };
853 union __anonunion___u_48 {   853 union __anonunion___u_48 {
854    float __f ;   854    float __f ;
855    int __i ;   855    int __i ;
856 };   856 };
857 union __anonunion___u_49 {   857 union __anonunion___u_49 {
858    double __d ;   858    double __d ;
859    int __i[2] ;   859    int __i[2] ;
860 };   860 };
861 union __anonunion___u_50 {   861 union __anonunion___u_50 {
862    long double __l ;   862    long double __l ;
863    int __i[3] ;   863    int __i[3] ;
864 };   864 };
865 union __anonunion___n_51 {   865 union __anonunion___n_51 {
866    long double __xld ;   866    long double __xld ;
867    unsigned int __xi[3] ;   867    unsigned int __xi[3] ;
868 };   868 };
869 union __anonunion_52 {   869 union __anonunion_52 {
870    double __d ;   870    double __d ;
871    int __i[2] ;   871    int __i[2] ;
872 };   872 };
873 enum __anonenum_53 {   873 enum __anonenum_53 {
874     _ISupper = 256,   874     _ISupper = 256,
875     _ISlower = 512,   875     _ISlower = 512,
876     _ISalpha = 1024,   876     _ISalpha = 1024,
877     _ISdigit = 2048,   877     _ISdigit = 2048,
878     _ISxdigit = 4096,   878     _ISxdigit = 4096,
879     _ISspace = 8192,   879     _ISspace = 8192,
880     _ISprint = 16384,   880     _ISprint = 16384,
881     _ISgraph = 32768,   881     _ISgraph = 32768,
882     _ISblank = 1,   882     _ISblank = 1,
883     _IScntrl = 2,   883     _IScntrl = 2,
884     _ISpunct = 4,   884     _ISpunct = 4,
885     _ISalnum = 8   885     _ISalnum = 8
886 } ;   886 } ;
887 typedef __useconds_t useconds_t;   887 typedef __useconds_t useconds_t;
888 typedef __intptr_t intptr_t;   888 typedef __intptr_t intptr_t;
889 typedef __socklen_t socklen_t;   889 typedef __socklen_t socklen_t;
890 enum __anonenum_54 {   890 enum __anonenum_54 {
891     _PC_LINK_MAX = 0,   891     _PC_LINK_MAX = 0,
892     _PC_MAX_CANON = 1,   892     _PC_MAX_CANON = 1,
893     _PC_MAX_INPUT = 2,   893     _PC_MAX_INPUT = 2,
894     _PC_NAME_MAX = 3,   894     _PC_NAME_MAX = 3,
895     _PC_PATH_MAX = 4,   895     _PC_PATH_MAX = 4,
896     _PC_PIPE_BUF = 5,   896     _PC_PIPE_BUF = 5,
897     _PC_CHOWN_RESTRICTED = 6,   897     _PC_CHOWN_RESTRICTED = 6,
898     _PC_NO_TRUNC = 7,   898     _PC_NO_TRUNC = 7,
899     _PC_VDISABLE = 8,   899     _PC_VDISABLE = 8,
900     _PC_SYNC_IO = 9,   900     _PC_SYNC_IO = 9,
901     _PC_ASYNC_IO = 10,   901     _PC_ASYNC_IO = 10,
902     _PC_PRIO_IO = 11,   902     _PC_PRIO_IO = 11,
903     _PC_SOCK_MAXBUF = 12,   903     _PC_SOCK_MAXBUF = 12,
904     _PC_FILESIZEBITS = 13,   904     _PC_FILESIZEBITS = 13,
905     _PC_REC_INCR_XFER_SIZE = 14,   905     _PC_REC_INCR_XFER_SIZE = 14,
906     _PC_REC_MAX_XFER_SIZE = 15,   906     _PC_REC_MAX_XFER_SIZE = 15,
907     _PC_REC_MIN_XFER_SIZE = 16,   907     _PC_REC_MIN_XFER_SIZE = 16,
908     _PC_REC_XFER_ALIGN = 17,   908     _PC_REC_XFER_ALIGN = 17,
909     _PC_ALLOC_SIZE_MIN = 18,   909     _PC_ALLOC_SIZE_MIN = 18,
910     _PC_SYMLINK_MAX = 19,   910     _PC_SYMLINK_MAX = 19,
911     _PC_2_SYMLINKS = 20   911     _PC_2_SYMLINKS = 20
912 } ;   912 } ;
913 enum __anonenum_55 {   913 enum __anonenum_55 {
914     _SC_ARG_MAX = 0,   914     _SC_ARG_MAX = 0,
915     _SC_CHILD_MAX = 1,   915     _SC_CHILD_MAX = 1,
916     _SC_CLK_TCK = 2,   916     _SC_CLK_TCK = 2,
917     _SC_NGROUPS_MAX = 3,   917     _SC_NGROUPS_MAX = 3,
918     _SC_OPEN_MAX = 4,   918     _SC_OPEN_MAX = 4,
919     _SC_STREAM_MAX = 5,   919     _SC_STREAM_MAX = 5,
920     _SC_TZNAME_MAX = 6,   920     _SC_TZNAME_MAX = 6,
921     _SC_JOB_CONTROL = 7,   921     _SC_JOB_CONTROL = 7,
922     _SC_SAVED_IDS = 8,   922     _SC_SAVED_IDS = 8,
923     _SC_REALTIME_SIGNALS = 9,   923     _SC_REALTIME_SIGNALS = 9,
924     _SC_PRIORITY_SCHEDULING = 10,   924     _SC_PRIORITY_SCHEDULING = 10,
925     _SC_TIMERS = 11,   925     _SC_TIMERS = 11,
926     _SC_ASYNCHRONOUS_IO = 12,   926     _SC_ASYNCHRONOUS_IO = 12,
927     _SC_PRIORITIZED_IO = 13,   927     _SC_PRIORITIZED_IO = 13,
928     _SC_SYNCHRONIZED_IO = 14,   928     _SC_SYNCHRONIZED_IO = 14,
929     _SC_FSYNC = 15,   929     _SC_FSYNC = 15,
930     _SC_MAPPED_FILES = 16,   930     _SC_MAPPED_FILES = 16,
931     _SC_MEMLOCK = 17,   931     _SC_MEMLOCK = 17,
932     _SC_MEMLOCK_RANGE = 18,   932     _SC_MEMLOCK_RANGE = 18,
933     _SC_MEMORY_PROTECTION = 19,   933     _SC_MEMORY_PROTECTION = 19,
934     _SC_MESSAGE_PASSING = 20,   934     _SC_MESSAGE_PASSING = 20,
935     _SC_SEMAPHORES = 21,   935     _SC_SEMAPHORES = 21,
936     _SC_SHARED_MEMORY_OBJECTS = 22,   936     _SC_SHARED_MEMORY_OBJECTS = 22,
937     _SC_AIO_LISTIO_MAX = 23,   937     _SC_AIO_LISTIO_MAX = 23,
938     _SC_AIO_MAX = 24,   938     _SC_AIO_MAX = 24,
939     _SC_AIO_PRIO_DELTA_MAX = 25,   939     _SC_AIO_PRIO_DELTA_MAX = 25,
940     _SC_DELAYTIMER_MAX = 26,   940     _SC_DELAYTIMER_MAX = 26,
941     _SC_MQ_OPEN_MAX = 27,   941     _SC_MQ_OPEN_MAX = 27,
942     _SC_MQ_PRIO_MAX = 28,   942     _SC_MQ_PRIO_MAX = 28,
943     _SC_VERSION = 29,   943     _SC_VERSION = 29,
944     _SC_PAGESIZE = 30,   944     _SC_PAGESIZE = 30,
945     _SC_RTSIG_MAX = 31,   945     _SC_RTSIG_MAX = 31,
946     _SC_SEM_NSEMS_MAX = 32,   946     _SC_SEM_NSEMS_MAX = 32,
947     _SC_SEM_VALUE_MAX = 33,   947     _SC_SEM_VALUE_MAX = 33,
948     _SC_SIGQUEUE_MAX = 34,   948     _SC_SIGQUEUE_MAX = 34,
949     _SC_TIMER_MAX = 35,   949     _SC_TIMER_MAX = 35,
950     _SC_BC_BASE_MAX = 36,   950     _SC_BC_BASE_MAX = 36,
951     _SC_BC_DIM_MAX = 37,   951     _SC_BC_DIM_MAX = 37,
952     _SC_BC_SCALE_MAX = 38,   952     _SC_BC_SCALE_MAX = 38,
953     _SC_BC_STRING_MAX = 39,   953     _SC_BC_STRING_MAX = 39,
954     _SC_COLL_WEIGHTS_MAX = 40,   954     _SC_COLL_WEIGHTS_MAX = 40,
955     _SC_EQUIV_CLASS_MAX = 41,   955     _SC_EQUIV_CLASS_MAX = 41,
956     _SC_EXPR_NEST_MAX = 42,   956     _SC_EXPR_NEST_MAX = 42,
957     _SC_LINE_MAX = 43,   957     _SC_LINE_MAX = 43,
958     _SC_RE_DUP_MAX = 44,   958     _SC_RE_DUP_MAX = 44,
959     _SC_CHARCLASS_NAME_MAX = 45,   959     _SC_CHARCLASS_NAME_MAX = 45,
960     _SC_2_VERSION = 46,   960     _SC_2_VERSION = 46,
961     _SC_2_C_BIND = 47,   961     _SC_2_C_BIND = 47,
962     _SC_2_C_DEV = 48,   962     _SC_2_C_DEV = 48,
963     _SC_2_FORT_DEV = 49,   963     _SC_2_FORT_DEV = 49,
964     _SC_2_FORT_RUN = 50,   964     _SC_2_FORT_RUN = 50,
965     _SC_2_SW_DEV = 51,   965     _SC_2_SW_DEV = 51,
966     _SC_2_LOCALEDEF = 52,   966     _SC_2_LOCALEDEF = 52,
967     _SC_PII = 53,   967     _SC_PII = 53,
968     _SC_PII_XTI = 54,   968     _SC_PII_XTI = 54,
969     _SC_PII_SOCKET = 55,   969     _SC_PII_SOCKET = 55,
970     _SC_PII_INTERNET = 56,   970     _SC_PII_INTERNET = 56,
971     _SC_PII_OSI = 57,   971     _SC_PII_OSI = 57,
972     _SC_POLL = 58,   972     _SC_POLL = 58,
973     _SC_SELECT = 59,   973     _SC_SELECT = 59,
974     _SC_UIO_MAXIOV = 60,   974     _SC_UIO_MAXIOV = 60,
975     _SC_IOV_MAX = 60,   975     _SC_IOV_MAX = 60,
976     _SC_PII_INTERNET_STREAM = 61,   976     _SC_PII_INTERNET_STREAM = 61,
977     _SC_PII_INTERNET_DGRAM = 62,   977     _SC_PII_INTERNET_DGRAM = 62,
978     _SC_PII_OSI_COTS = 63,   978     _SC_PII_OSI_COTS = 63,
979     _SC_PII_OSI_CLTS = 64,   979     _SC_PII_OSI_CLTS = 64,
980     _SC_PII_OSI_M = 65,   980     _SC_PII_OSI_M = 65,
981     _SC_T_IOV_MAX = 66,   981     _SC_T_IOV_MAX = 66,
982     _SC_THREADS = 67,   982     _SC_THREADS = 67,
983     _SC_THREAD_SAFE_FUNCTIONS = 68,   983     _SC_THREAD_SAFE_FUNCTIONS = 68,
984     _SC_GETGR_R_SIZE_MAX = 69,   984     _SC_GETGR_R_SIZE_MAX = 69,
985     _SC_GETPW_R_SIZE_MAX = 70,   985     _SC_GETPW_R_SIZE_MAX = 70,
986     _SC_LOGIN_NAME_MAX = 71,   986     _SC_LOGIN_NAME_MAX = 71,
987     _SC_TTY_NAME_MAX = 72,   987     _SC_TTY_NAME_MAX = 72,
988     _SC_THREAD_DESTRUCTOR_ITERATIONS = 73,   988     _SC_THREAD_DESTRUCTOR_ITERATIONS = 73,
989     _SC_THREAD_KEYS_MAX = 74,   989     _SC_THREAD_KEYS_MAX = 74,
990     _SC_THREAD_STACK_MIN = 75,   990     _SC_THREAD_STACK_MIN = 75,
991     _SC_THREAD_THREADS_MAX = 76,   991     _SC_THREAD_THREADS_MAX = 76,
992     _SC_THREAD_ATTR_STACKADDR = 77,   992     _SC_THREAD_ATTR_STACKADDR = 77,
993     _SC_THREAD_ATTR_STACKSIZE = 78,   993     _SC_THREAD_ATTR_STACKSIZE = 78,
994     _SC_THREAD_PRIORITY_SCHEDULING = 79,   994     _SC_THREAD_PRIORITY_SCHEDULING = 79,
995     _SC_THREAD_PRIO_INHERIT = 80,   995     _SC_THREAD_PRIO_INHERIT = 80,
996     _SC_THREAD_PRIO_PROTECT = 81,   996     _SC_THREAD_PRIO_PROTECT = 81,
997     _SC_THREAD_PROCESS_SHARED = 82,   997     _SC_THREAD_PROCESS_SHARED = 82,
998     _SC_NPROCESSORS_CONF = 83,   998     _SC_NPROCESSORS_CONF = 83,
999     _SC_NPROCESSORS_ONLN = 84,   999     _SC_NPROCESSORS_ONLN = 84,
1000     _SC_PHYS_PAGES = 85,   1000     _SC_PHYS_PAGES = 85,
1001     _SC_AVPHYS_PAGES = 86,   1001     _SC_AVPHYS_PAGES = 86,
1002     _SC_ATEXIT_MAX = 87,   1002     _SC_ATEXIT_MAX = 87,
1003     _SC_PASS_MAX = 88,   1003     _SC_PASS_MAX = 88,
1004     _SC_XOPEN_VERSION = 89,   1004     _SC_XOPEN_VERSION = 89,
1005     _SC_XOPEN_XCU_VERSION = 90,   1005     _SC_XOPEN_XCU_VERSION = 90,
1006     _SC_XOPEN_UNIX = 91,   1006     _SC_XOPEN_UNIX = 91,
1007     _SC_XOPEN_CRYPT = 92,   1007     _SC_XOPEN_CRYPT = 92,
1008     _SC_XOPEN_ENH_I18N = 93,   1008     _SC_XOPEN_ENH_I18N = 93,
1009     _SC_XOPEN_SHM = 94,   1009     _SC_XOPEN_SHM = 94,
1010     _SC_2_CHAR_TERM = 95,   1010     _SC_2_CHAR_TERM = 95,
1011     _SC_2_C_VERSION = 96,   1011     _SC_2_C_VERSION = 96,
1012     _SC_2_UPE = 97,   1012     _SC_2_UPE = 97,
1013     _SC_XOPEN_XPG2 = 98,   1013     _SC_XOPEN_XPG2 = 98,
1014     _SC_XOPEN_XPG3 = 99,   1014     _SC_XOPEN_XPG3 = 99,
1015     _SC_XOPEN_XPG4 = 100,   1015     _SC_XOPEN_XPG4 = 100,
1016     _SC_CHAR_BIT = 101,   1016     _SC_CHAR_BIT = 101,
1017     _SC_CHAR_MAX = 102,   1017     _SC_CHAR_MAX = 102,
1018     _SC_CHAR_MIN = 103,   1018     _SC_CHAR_MIN = 103,
1019     _SC_INT_MAX = 104,   1019     _SC_INT_MAX = 104,
1020     _SC_INT_MIN = 105,   1020     _SC_INT_MIN = 105,
1021     _SC_LONG_BIT = 106,   1021     _SC_LONG_BIT = 106,
1022     _SC_WORD_BIT = 107,   1022     _SC_WORD_BIT = 107,
1023     _SC_MB_LEN_MAX = 108,   1023     _SC_MB_LEN_MAX = 108,
1024     _SC_NZERO = 109,   1024     _SC_NZERO = 109,
1025     _SC_SSIZE_MAX = 110,   1025     _SC_SSIZE_MAX = 110,
1026     _SC_SCHAR_MAX = 111,   1026     _SC_SCHAR_MAX = 111,
1027     _SC_SCHAR_MIN = 112,   1027     _SC_SCHAR_MIN = 112,
1028     _SC_SHRT_MAX = 113,   1028     _SC_SHRT_MAX = 113,
1029     _SC_SHRT_MIN = 114,   1029     _SC_SHRT_MIN = 114,
1030     _SC_UCHAR_MAX = 115,   1030     _SC_UCHAR_MAX = 115,
1031     _SC_UINT_MAX = 116,   1031     _SC_UINT_MAX = 116,
1032     _SC_ULONG_MAX = 117,   1032     _SC_ULONG_MAX = 117,
1033     _SC_USHRT_MAX = 118,   1033     _SC_USHRT_MAX = 118,
1034     _SC_NL_ARGMAX = 119,   1034     _SC_NL_ARGMAX = 119,
1035     _SC_NL_LANGMAX = 120,   1035     _SC_NL_LANGMAX = 120,
1036     _SC_NL_MSGMAX = 121,   1036     _SC_NL_MSGMAX = 121,
1037     _SC_NL_NMAX = 122,   1037     _SC_NL_NMAX = 122,
1038     _SC_NL_SETMAX = 123,   1038     _SC_NL_SETMAX = 123,
1039     _SC_NL_TEXTMAX = 124,   1039     _SC_NL_TEXTMAX = 124,
1040     _SC_XBS5_ILP32_OFF32 = 125,   1040     _SC_XBS5_ILP32_OFF32 = 125,
1041     _SC_XBS5_ILP32_OFFBIG = 126,   1041     _SC_XBS5_ILP32_OFFBIG = 126,
1042     _SC_XBS5_LP64_OFF64 = 127,   1042     _SC_XBS5_LP64_OFF64 = 127,
1043     _SC_XBS5_LPBIG_OFFBIG = 128,   1043     _SC_XBS5_LPBIG_OFFBIG = 128,
1044     _SC_XOPEN_LEGACY = 129,   1044     _SC_XOPEN_LEGACY = 129,
1045     _SC_XOPEN_REALTIME = 130,   1045     _SC_XOPEN_REALTIME = 130,
1046     _SC_XOPEN_REALTIME_THREADS = 131,   1046     _SC_XOPEN_REALTIME_THREADS = 131,
1047     _SC_ADVISORY_INFO = 132,   1047     _SC_ADVISORY_INFO = 132,
1048     _SC_BARRIERS = 133,   1048     _SC_BARRIERS = 133,
1049     _SC_BASE = 134,   1049     _SC_BASE = 134,
1050     _SC_C_LANG_SUPPORT = 135,   1050     _SC_C_LANG_SUPPORT = 135,
1051     _SC_C_LANG_SUPPORT_R = 136,   1051     _SC_C_LANG_SUPPORT_R = 136,
1052     _SC_CLOCK_SELECTION = 137,   1052     _SC_CLOCK_SELECTION = 137,
1053     _SC_CPUTIME = 138,   1053     _SC_CPUTIME = 138,
1054     _SC_THREAD_CPUTIME = 139,   1054     _SC_THREAD_CPUTIME = 139,
1055     _SC_DEVICE_IO = 140,   1055     _SC_DEVICE_IO = 140,
1056     _SC_DEVICE_SPECIFIC = 141,   1056     _SC_DEVICE_SPECIFIC = 141,
1057     _SC_DEVICE_SPECIFIC_R = 142,   1057     _SC_DEVICE_SPECIFIC_R = 142,
1058     _SC_FD_MGMT = 143,   1058     _SC_FD_MGMT = 143,
1059     _SC_FIFO = 144,   1059     _SC_FIFO = 144,
1060     _SC_PIPE = 145,   1060     _SC_PIPE = 145,
1061     _SC_FILE_ATTRIBUTES = 146,   1061     _SC_FILE_ATTRIBUTES = 146,
1062     _SC_FILE_LOCKING = 147,   1062     _SC_FILE_LOCKING = 147,
1063     _SC_FILE_SYSTEM = 148,   1063     _SC_FILE_SYSTEM = 148,
1064     _SC_MONOTONIC_CLOCK = 149,   1064     _SC_MONOTONIC_CLOCK = 149,
1065     _SC_MULTI_PROCESS = 150,   1065     _SC_MULTI_PROCESS = 150,
1066     _SC_SINGLE_PROCESS = 151,   1066     _SC_SINGLE_PROCESS = 151,
1067     _SC_NETWORKING = 152,   1067     _SC_NETWORKING = 152,
1068     _SC_READER_WRITER_LOCKS = 153,   1068     _SC_READER_WRITER_LOCKS = 153,
1069     _SC_SPIN_LOCKS = 154,   1069     _SC_SPIN_LOCKS = 154,
1070     _SC_REGEXP = 155,   1070     _SC_REGEXP = 155,
1071     _SC_REGEX_VERSION = 156,   1071     _SC_REGEX_VERSION = 156,
1072     _SC_SHELL = 157,   1072     _SC_SHELL = 157,
1073     _SC_SIGNALS = 158,   1073     _SC_SIGNALS = 158,
1074     _SC_SPAWN = 159,   1074     _SC_SPAWN = 159,
1075     _SC_SPORADIC_SERVER = 160,   1075     _SC_SPORADIC_SERVER = 160,
1076     _SC_THREAD_SPORADIC_SERVER = 161,   1076     _SC_THREAD_SPORADIC_SERVER = 161,
1077     _SC_SYSTEM_DATABASE = 162,   1077     _SC_SYSTEM_DATABASE = 162,
1078     _SC_SYSTEM_DATABASE_R = 163,   1078     _SC_SYSTEM_DATABASE_R = 163,
1079     _SC_TIMEOUTS = 164,   1079     _SC_TIMEOUTS = 164,
1080     _SC_TYPED_MEMORY_OBJECTS = 165,   1080     _SC_TYPED_MEMORY_OBJECTS = 165,
1081     _SC_USER_GROUPS = 166,   1081     _SC_USER_GROUPS = 166,
1082     _SC_USER_GROUPS_R = 167,   1082     _SC_USER_GROUPS_R = 167,
1083     _SC_2_PBS = 168,   1083     _SC_2_PBS = 168,
1084     _SC_2_PBS_ACCOUNTING = 169,   1084     _SC_2_PBS_ACCOUNTING = 169,
1085     _SC_2_PBS_LOCATE = 170,   1085     _SC_2_PBS_LOCATE = 170,
1086     _SC_2_PBS_MESSAGE = 171,   1086     _SC_2_PBS_MESSAGE = 171,
1087     _SC_2_PBS_TRACK = 172,   1087     _SC_2_PBS_TRACK = 172,
1088     _SC_SYMLOOP_MAX = 173,   1088     _SC_SYMLOOP_MAX = 173,
1089     _SC_STREAMS = 174,   1089     _SC_STREAMS = 174,
1090     _SC_2_PBS_CHECKPOINT = 175,   1090     _SC_2_PBS_CHECKPOINT = 175,
1091     _SC_V6_ILP32_OFF32 = 176,   1091     _SC_V6_ILP32_OFF32 = 176,
1092     _SC_V6_ILP32_OFFBIG = 177,   1092     _SC_V6_ILP32_OFFBIG = 177,
1093     _SC_V6_LP64_OFF64 = 178,   1093     _SC_V6_LP64_OFF64 = 178,
1094     _SC_V6_LPBIG_OFFBIG = 179,   1094     _SC_V6_LPBIG_OFFBIG = 179,
1095     _SC_HOST_NAME_MAX = 180,   1095     _SC_HOST_NAME_MAX = 180,
1096     _SC_TRACE = 181,   1096     _SC_TRACE = 181,
1097     _SC_TRACE_EVENT_FILTER = 182,   1097     _SC_TRACE_EVENT_FILTER = 182,
1098     _SC_TRACE_INHERIT = 183,   1098     _SC_TRACE_INHERIT = 183,
1099     _SC_TRACE_LOG = 184,   1099     _SC_TRACE_LOG = 184,
1100     _SC_LEVEL1_ICACHE_SIZE = 185,   1100     _SC_LEVEL1_ICACHE_SIZE = 185,
1101     _SC_LEVEL1_ICACHE_ASSOC = 186,   1101     _SC_LEVEL1_ICACHE_ASSOC = 186,
1102     _SC_LEVEL1_ICACHE_LINESIZE = 187,   1102     _SC_LEVEL1_ICACHE_LINESIZE = 187,
1103     _SC_LEVEL1_DCACHE_SIZE = 188,   1103     _SC_LEVEL1_DCACHE_SIZE = 188,
1104     _SC_LEVEL1_DCACHE_ASSOC = 189,   1104     _SC_LEVEL1_DCACHE_ASSOC = 189,
1105     _SC_LEVEL1_DCACHE_LINESIZE = 190,   1105     _SC_LEVEL1_DCACHE_LINESIZE = 190,
1106     _SC_LEVEL2_CACHE_SIZE = 191,   1106     _SC_LEVEL2_CACHE_SIZE = 191,
1107     _SC_LEVEL2_CACHE_ASSOC = 192,   1107     _SC_LEVEL2_CACHE_ASSOC = 192,
1108     _SC_LEVEL2_CACHE_LINESIZE = 193,   1108     _SC_LEVEL2_CACHE_LINESIZE = 193,
1109     _SC_LEVEL3_CACHE_SIZE = 194,   1109     _SC_LEVEL3_CACHE_SIZE = 194,
1110     _SC_LEVEL3_CACHE_ASSOC = 195,   1110     _SC_LEVEL3_CACHE_ASSOC = 195,
1111     _SC_LEVEL3_CACHE_LINESIZE = 196,   1111     _SC_LEVEL3_CACHE_LINESIZE = 196,
1112     _SC_LEVEL4_CACHE_SIZE = 197,   1112     _SC_LEVEL4_CACHE_SIZE = 197,
1113     _SC_LEVEL4_CACHE_ASSOC = 198,   1113     _SC_LEVEL4_CACHE_ASSOC = 198,
1114     _SC_LEVEL4_CACHE_LINESIZE = 199,   1114     _SC_LEVEL4_CACHE_LINESIZE = 199,
1115     _SC_IPV6 = 235,   1115     _SC_IPV6 = 235,
1116     _SC_RAW_SOCKETS = 236,   1116     _SC_RAW_SOCKETS = 236,
1117     _SC_V7_ILP32_OFF32 = 237,   1117     _SC_V7_ILP32_OFF32 = 237,
1118     _SC_V7_ILP32_OFFBIG = 238,   1118     _SC_V7_ILP32_OFFBIG = 238,
1119     _SC_V7_LP64_OFF64 = 239,   1119     _SC_V7_LP64_OFF64 = 239,
1120     _SC_V7_LPBIG_OFFBIG = 240,   1120     _SC_V7_LPBIG_OFFBIG = 240,
1121     _SC_SS_REPL_MAX = 241,   1121     _SC_SS_REPL_MAX = 241,
1122     _SC_TRACE_EVENT_NAME_MAX = 242,   1122     _SC_TRACE_EVENT_NAME_MAX = 242,
1123     _SC_TRACE_NAME_MAX = 243,   1123     _SC_TRACE_NAME_MAX = 243,
1124     _SC_TRACE_SYS_MAX = 244,   1124     _SC_TRACE_SYS_MAX = 244,
1125     _SC_TRACE_USER_EVENT_MAX = 245,   1125     _SC_TRACE_USER_EVENT_MAX = 245,
1126     _SC_XOPEN_STREAMS = 246,   1126     _SC_XOPEN_STREAMS = 246,
1127     _SC_THREAD_ROBUST_PRIO_INHERIT = 247,   1127     _SC_THREAD_ROBUST_PRIO_INHERIT = 247,
1128     _SC_THREAD_ROBUST_PRIO_PROTECT = 248   1128     _SC_THREAD_ROBUST_PRIO_PROTECT = 248
1129 } ;   1129 } ;
1130 enum __anonenum_56 {   1130 enum __anonenum_56 {
1131     _CS_PATH = 0,   1131     _CS_PATH = 0,
1132     _CS_V6_WIDTH_RESTRICTED_ENVS = 1,   1132     _CS_V6_WIDTH_RESTRICTED_ENVS = 1,
1133     _CS_GNU_LIBC_VERSION = 2,   1133     _CS_GNU_LIBC_VERSION = 2,
1134     _CS_GNU_LIBPTHREAD_VERSION = 3,   1134     _CS_GNU_LIBPTHREAD_VERSION = 3,
1135     _CS_V5_WIDTH_RESTRICTED_ENVS = 4,   1135     _CS_V5_WIDTH_RESTRICTED_ENVS = 4,
1136     _CS_V7_WIDTH_RESTRICTED_ENVS = 5,   1136     _CS_V7_WIDTH_RESTRICTED_ENVS = 5,
1137     _CS_LFS_CFLAGS = 1000,   1137     _CS_LFS_CFLAGS = 1000,
1138     _CS_LFS_LDFLAGS = 1001,   1138     _CS_LFS_LDFLAGS = 1001,
1139     _CS_LFS_LIBS = 1002,   1139     _CS_LFS_LIBS = 1002,
1140     _CS_LFS_LINTFLAGS = 1003,   1140     _CS_LFS_LINTFLAGS = 1003,
1141     _CS_LFS64_CFLAGS = 1004,   1141     _CS_LFS64_CFLAGS = 1004,
1142     _CS_LFS64_LDFLAGS = 1005,   1142     _CS_LFS64_LDFLAGS = 1005,
1143     _CS_LFS64_LIBS = 1006,   1143     _CS_LFS64_LIBS = 1006,
1144     _CS_LFS64_LINTFLAGS = 1007,   1144     _CS_LFS64_LINTFLAGS = 1007,
1145     _CS_XBS5_ILP32_OFF32_CFLAGS = 1100,   1145     _CS_XBS5_ILP32_OFF32_CFLAGS = 1100,
1146     _CS_XBS5_ILP32_OFF32_LDFLAGS = 1101,   1146     _CS_XBS5_ILP32_OFF32_LDFLAGS = 1101,
1147     _CS_XBS5_ILP32_OFF32_LIBS = 1102,   1147     _CS_XBS5_ILP32_OFF32_LIBS = 1102,
1148     _CS_XBS5_ILP32_OFF32_LINTFLAGS = 1103,   1148     _CS_XBS5_ILP32_OFF32_LINTFLAGS = 1103,
1149     _CS_XBS5_ILP32_OFFBIG_CFLAGS = 1104,   1149     _CS_XBS5_ILP32_OFFBIG_CFLAGS = 1104,
1150     _CS_XBS5_ILP32_OFFBIG_LDFLAGS = 1105,   1150     _CS_XBS5_ILP32_OFFBIG_LDFLAGS = 1105,
1151     _CS_XBS5_ILP32_OFFBIG_LIBS = 1106,   1151     _CS_XBS5_ILP32_OFFBIG_LIBS = 1106,
1152     _CS_XBS5_ILP32_OFFBIG_LINTFLAGS = 1107,   1152     _CS_XBS5_ILP32_OFFBIG_LINTFLAGS = 1107,
1153     _CS_XBS5_LP64_OFF64_CFLAGS = 1108,   1153     _CS_XBS5_LP64_OFF64_CFLAGS = 1108,
1154     _CS_XBS5_LP64_OFF64_LDFLAGS = 1109,   1154     _CS_XBS5_LP64_OFF64_LDFLAGS = 1109,
1155     _CS_XBS5_LP64_OFF64_LIBS = 1110,   1155     _CS_XBS5_LP64_OFF64_LIBS = 1110,
1156     _CS_XBS5_LP64_OFF64_LINTFLAGS = 1111,   1156     _CS_XBS5_LP64_OFF64_LINTFLAGS = 1111,
1157     _CS_XBS5_LPBIG_OFFBIG_CFLAGS = 1112,   1157     _CS_XBS5_LPBIG_OFFBIG_CFLAGS = 1112,
1158     _CS_XBS5_LPBIG_OFFBIG_LDFLAGS = 1113,   1158     _CS_XBS5_LPBIG_OFFBIG_LDFLAGS = 1113,
1159     _CS_XBS5_LPBIG_OFFBIG_LIBS = 1114,   1159     _CS_XBS5_LPBIG_OFFBIG_LIBS = 1114,
1160     _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS = 1115,   1160     _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS = 1115,
1161     _CS_POSIX_V6_ILP32_OFF32_CFLAGS = 1116,   1161     _CS_POSIX_V6_ILP32_OFF32_CFLAGS = 1116,
1162     _CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 1117,   1162     _CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 1117,
1163     _CS_POSIX_V6_ILP32_OFF32_LIBS = 1118,   1163     _CS_POSIX_V6_ILP32_OFF32_LIBS = 1118,
1164     _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS = 1119,   1164     _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS = 1119,
1165     _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 1120,   1165     _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 1120,
1166     _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 1121,   1166     _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 1121,
1167     _CS_POSIX_V6_ILP32_OFFBIG_LIBS = 1122,   1167     _CS_POSIX_V6_ILP32_OFFBIG_LIBS = 1122,
1168     _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS = 1123,   1168     _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS = 1123,
1169     _CS_POSIX_V6_LP64_OFF64_CFLAGS = 1124,   1169     _CS_POSIX_V6_LP64_OFF64_CFLAGS = 1124,
1170     _CS_POSIX_V6_LP64_OFF64_LDFLAGS = 1125,   1170     _CS_POSIX_V6_LP64_OFF64_LDFLAGS = 1125,
1171     _CS_POSIX_V6_LP64_OFF64_LIBS = 1126,   1171     _CS_POSIX_V6_LP64_OFF64_LIBS = 1126,
1172     _CS_POSIX_V6_LP64_OFF64_LINTFLAGS = 1127,   1172     _CS_POSIX_V6_LP64_OFF64_LINTFLAGS = 1127,
1173     _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 1128,   1173     _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 1128,
1174     _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 1129,   1174     _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 1129,
1175     _CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 1130,   1175     _CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 1130,
1176     _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS = 1131,   1176     _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS = 1131,
1177     _CS_POSIX_V7_ILP32_OFF32_CFLAGS = 1132,   1177     _CS_POSIX_V7_ILP32_OFF32_CFLAGS = 1132,
1178     _CS_POSIX_V7_ILP32_OFF32_LDFLAGS = 1133,   1178     _CS_POSIX_V7_ILP32_OFF32_LDFLAGS = 1133,
1179     _CS_POSIX_V7_ILP32_OFF32_LIBS = 1134,   1179     _CS_POSIX_V7_ILP32_OFF32_LIBS = 1134,
1180     _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS = 1135,   1180     _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS = 1135,
1181     _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS = 1136,   1181     _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS = 1136,
1182     _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS = 1137,   1182     _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS = 1137,
1183     _CS_POSIX_V7_ILP32_OFFBIG_LIBS = 1138,   1183     _CS_POSIX_V7_ILP32_OFFBIG_LIBS = 1138,
1184     _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS = 1139,   1184     _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS = 1139,
1185     _CS_POSIX_V7_LP64_OFF64_CFLAGS = 1140,   1185     _CS_POSIX_V7_LP64_OFF64_CFLAGS = 1140,
1186     _CS_POSIX_V7_LP64_OFF64_LDFLAGS = 1141,   1186     _CS_POSIX_V7_LP64_OFF64_LDFLAGS = 1141,
1187     _CS_POSIX_V7_LP64_OFF64_LIBS = 1142,   1187     _CS_POSIX_V7_LP64_OFF64_LIBS = 1142,
1188     _CS_POSIX_V7_LP64_OFF64_LINTFLAGS = 1143,   1188     _CS_POSIX_V7_LP64_OFF64_LINTFLAGS = 1143,
1189     _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS = 1144,   1189     _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS = 1144,
1190     _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS = 1145,   1190     _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS = 1145,
1191     _CS_POSIX_V7_LPBIG_OFFBIG_LIBS = 1146,   1191     _CS_POSIX_V7_LPBIG_OFFBIG_LIBS = 1146,
1192     _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS = 1147,   1192     _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS = 1147,
1193     _CS_V6_ENV = 1148,   1193     _CS_V6_ENV = 1148,
1194     _CS_V7_ENV = 1149   1194     _CS_V7_ENV = 1149
1195 } ;   1195 } ;
1196 typedef unsigned char uint8_t;   1196 typedef unsigned char uint8_t;
1197 typedef unsigned short uint16_t;   1197 typedef unsigned short uint16_t;
1198 typedef unsigned int uint32_t;   1198 typedef unsigned int uint32_t;
1199 typedef unsigned long long uint64_t;   1199 typedef unsigned long long uint64_t;
1200 typedef signed char int_least8_t;   1200 typedef signed char int_least8_t;
1201 typedef short int_least16_t;   1201 typedef short int_least16_t;
1202 typedef int int_least32_t;   1202 typedef int int_least32_t;
1203 typedef long long int_least64_t;   1203 typedef long long int_least64_t;
1204 typedef unsigned char uint_least8_t;   1204 typedef unsigned char uint_least8_t;
1205 typedef unsigned short uint_least16_t;   1205 typedef unsigned short uint_least16_t;
1206 typedef unsigned int uint_least32_t;   1206 typedef unsigned int uint_least32_t;
1207 typedef unsigned long long uint_least64_t;   1207 typedef unsigned long long uint_least64_t;
1208 typedef signed char int_fast8_t;   1208 typedef signed char int_fast8_t;
1209 typedef int int_fast16_t;   1209 typedef int int_fast16_t;
1210 typedef int int_fast32_t;   1210 typedef int int_fast32_t;
1211 typedef long long int_fast64_t;   1211 typedef long long int_fast64_t;
1212 typedef unsigned char uint_fast8_t;   1212 typedef unsigned char uint_fast8_t;
1213 typedef unsigned int uint_fast16_t;   1213 typedef unsigned int uint_fast16_t;
1214 typedef unsigned int uint_fast32_t;   1214 typedef unsigned int uint_fast32_t;
1215 typedef unsigned long long uint_fast64_t;   1215 typedef unsigned long long uint_fast64_t;
1216 typedef unsigned int uintptr_t;   1216 typedef unsigned int uintptr_t;
1217 typedef long long intmax_t;   1217 typedef long long intmax_t;
1218 typedef unsigned long long uintmax_t;   1218 typedef unsigned long long uintmax_t;
1219 struct offset {   1219 struct offset {
1220    uint32 tmargin ;   1220    uint32 tmargin ;
1221    uint32 lmargin ;   1221    uint32 lmargin ;
1222    uint32 bmargin ;   1222    uint32 bmargin ;
1223    uint32 rmargin ;   1223    uint32 rmargin ;
1224    uint32 crop_width ;   1224    uint32 crop_width ;
1225    uint32 crop_length ;   1225    uint32 crop_length ;
1226    uint32 startx ;   1226    uint32 startx ;
1227    uint32 endx ;   1227    uint32 endx ;
1228    uint32 starty ;   1228    uint32 starty ;
1229    uint32 endy ;   1229    uint32 endy ;
1230 };   1230 };
1231 struct buffinfo {   1231 struct buffinfo {
1232    uint32 size ;   1232    uint32 size ;
1233    unsigned char *buffer ;   1233    unsigned char *buffer ;
1234 };   1234 };
1235 struct zone {   1235 struct zone {
1236    int position ;   1236    int position ;
1237    int total ;   1237    int total ;
1238 };   1238 };
1239 struct pageseg {   1239 struct pageseg {
1240    uint32 x1 ;   1240    uint32 x1 ;
1241    uint32 x2 ;   1241    uint32 x2 ;
1242    uint32 y1 ;   1242    uint32 y1 ;
1243    uint32 y2 ;   1243    uint32 y2 ;
1244    int position ;   1244    int position ;
1245    int total ;   1245    int total ;
1246    uint32 buffsize ;   1246    uint32 buffsize ;
1247 };   1247 };
1248 struct coordpairs {   1248 struct coordpairs {
1249    double X1 ;   1249    double X1 ;
1250    double X2 ;   1250    double X2 ;
1251    double Y1 ;   1251    double Y1 ;
1252    double Y2 ;   1252    double Y2 ;
1253 };   1253 };
1254 struct region {   1254 struct region {
1255    uint32 x1 ;   1255    uint32 x1 ;
1256    uint32 x2 ;   1256    uint32 x2 ;
1257    uint32 y1 ;   1257    uint32 y1 ;
1258    uint32 y2 ;   1258    uint32 y2 ;
1259    uint32 width ;   1259    uint32 width ;
1260    uint32 length ;   1260    uint32 length ;
1261    uint32 buffsize ;   1261    uint32 buffsize ;
1262    unsigned char *buffptr ;   1262    unsigned char *buffptr ;
1263 };   1263 };
1264 struct crop_mask {   1264 struct crop_mask {
1265    double width ;   1265    double width ;
1266    double length ;   1266    double length ;
1267    double margins[4] ;   1267    double margins[4] ;
1268    float xres ;   1268    float xres ;
1269    float yres ;   1269    float yres ;
1270    uint32 combined_width ;   1270    uint32 combined_width ;
1271    uint32 combined_length ;   1271    uint32 combined_length ;
1272    uint32 bufftotal ;   1272    uint32 bufftotal ;
1273    uint16 img_mode ;   1273    uint16 img_mode ;
1274    uint16 exp_mode ;   1274    uint16 exp_mode ;
1275    uint16 crop_mode ;   1275    uint16 crop_mode ;
1276    uint16 res_unit ;   1276    uint16 res_unit ;
1277    uint16 edge_ref ;   1277    uint16 edge_ref ;
1278    uint16 rotation ;   1278    uint16 rotation ;
1279    uint16 mirror ;   1279    uint16 mirror ;
1280    uint16 invert ;   1280    uint16 invert ;
1281    uint16 photometric ;   1281    uint16 photometric ;
1282    uint16 selections ;   1282    uint16 selections ;
1283    uint16 regions ;   1283    uint16 regions ;
1284    struct region regionlist[8] ;   1284    struct region regionlist[8] ;
1285    uint16 zones ;   1285    uint16 zones ;
1286    struct zone zonelist[8] ;   1286    struct zone zonelist[8] ;
1287    struct coordpairs corners[8] ;   1287    struct coordpairs corners[8] ;
1288 };   1288 };
1289 struct paperdef {   1289 struct paperdef {
1290    char name[15] ;   1290    char name[15] ;
1291    double width ;   1291    double width ;
1292    double length ;   1292    double length ;
1293    double asratio ;   1293    double asratio ;
1294 };   1294 };
1295 struct image_data {   1295 struct image_data {
1296    float xres ;   1296    float xres ;
1297    float yres ;   1297    float yres ;
1298    uint32 width ;   1298    uint32 width ;
1299    uint32 length ;   1299    uint32 length ;
1300    uint16 res_unit ;   1300    uint16 res_unit ;
1301    uint16 bps ;   1301    uint16 bps ;
1302    uint16 spp ;   1302    uint16 spp ;
1303    uint16 planar ;   1303    uint16 planar ;
1304    uint16 photometric ;   1304    uint16 photometric ;
1305    uint16 orientation ;   1305    uint16 orientation ;
1306    uint16 adjustments ;   1306    uint16 adjustments ;
1307 };   1307 };
1308 struct pagedef {   1308 struct pagedef {
1309    char name[16] ;   1309    char name[16] ;
1310    double width ;   1310    double width ;
1311    double length ;   1311    double length ;
1312    double hmargin ;   1312    double hmargin ;
1313    double vmargin ;   1313    double vmargin ;
1314    double hres ;   1314    double hres ;
1315    double vres ;   1315    double vres ;
1316    uint32 mode ;   1316    uint32 mode ;
1317    uint16 res_unit ;   1317    uint16 res_unit ;
1318    unsigned int rows ;   1318    unsigned int rows ;
1319    unsigned int cols ;   1319    unsigned int cols ;
1320    unsigned int orient ;   1320    unsigned int orient ;
1321 };   1321 };
1322 struct dump_opts {   1322 struct dump_opts {
1323    int debug ;   1323    int debug ;
1324    int format ;   1324    int format ;
1325    int level ;   1325    int level ;
1326    char mode[4] ;   1326    char mode[4] ;
1327    char infilename[4097] ;   1327    char infilename[4097] ;
1328    char outfilename[4097] ;   1328    char outfilename[4097] ;
1329    FILE *infile ;   1329    FILE *infile ;
1330    FILE *outfile ;   1330    FILE *outfile ;
1331 };   1331 };
1332 struct cpTag {   1332 struct cpTag {
1333    uint16 tag ;   1333    uint16 tag ;
1334    uint16 count ;   1334    uint16 count ;
1335    TIFFDataType type ;   1335    TIFFDataType type ;
1336 };   1336 };
1337 extern int select(int __nfds , fd_set * __restrict  __readfds ,   1337 extern int select(int __nfds , fd_set * __restrict  __readfds ,
1338                   fd_set * __restrict  __writefds ,   1338                   fd_set * __restrict  __writefds ,
1339                   fd_set * __restrict  __exceptfds ,   1339                   fd_set * __restrict  __exceptfds ,
1340                   struct timeval * __restrict  __timeout ) ;   1340                   struct timeval * __restrict  __timeout ) ;
1341 extern int pselect(int __nfds , fd_set * __restrict  __readfds ,   1341 extern int pselect(int __nfds , fd_set * __restrict  __readfds ,
1342                    fd_set * __restrict  __writefds ,   1342                    fd_set * __restrict  __writefds ,
1343                    fd_set * __restrict  __exceptfds ,   1343                    fd_set * __restrict  __exceptfds ,
1344                    struct timespec  const  * __restrict  __timeout ,   1344                    struct timespec  const  * __restrict  __timeout ,
1345                    __sigset_t const   * __restrict  __sigmask ) ;   1345                    __sigset_t const   * __restrict  __sigmask ) ;
1346 __inline extern  __attribute__((__nothrow__)) unsigned int gnu_dev_major(unsigned long long __dev ) ;   1346 __inline extern  __attribute__((__nothrow__)) unsigned int gnu_dev_major(unsigned long long __dev ) ;
1347 __inline extern  __attribute__((__nothrow__)) unsigned int gnu_dev_minor(unsigned long long __dev ) ;   1347 __inline extern  __attribute__((__nothrow__)) unsigned int gnu_dev_minor(unsigned long long __dev ) ;
1348 __inline extern  __attribute__((__nothrow__)) unsigned long long gnu_dev_makedev(unsigned int __major ,   1348 __inline extern  __attribute__((__nothrow__)) unsigned long long gnu_dev_makedev(unsigned int __major ,
1349                                                                                  unsigned int __minor ) ;   1349                                                                                  unsigned int __minor ) ;
1350 __inline extern  __attribute__((__nothrow__)) unsigned int gnu_dev_major(unsigned long long __dev ) ;   1350 __inline extern  __attribute__((__nothrow__)) unsigned int gnu_dev_major(unsigned long long __dev ) ;
1351 __inline extern unsigned int gnu_dev_major(unsigned long long __dev )   1351 __inline extern unsigned int gnu_dev_major(unsigned long long __dev )
1352 {   1352 {
1353     1353  
1354     1354  
1355   {   1355   {
1356   return ((unsigned int )(((__dev >> 8) & 4095ULL) | (unsigned long long )((unsigned int )(__dev >> 32) & 4294963200U)));   1356   return ((unsigned int )(((__dev >> 8) & 4095ULL) | (unsigned long long )((unsigned int )(__dev >> 32) & 4294963200U)));
1357 }   1357 }
1358 }   1358 }
1359 __inline extern  __attribute__((__nothrow__)) unsigned int gnu_dev_minor(unsigned long long __dev ) ;   1359 __inline extern  __attribute__((__nothrow__)) unsigned int gnu_dev_minor(unsigned long long __dev ) ;
1360 __inline extern unsigned int gnu_dev_minor(unsigned long long __dev )   1360 __inline extern unsigned int gnu_dev_minor(unsigned long long __dev )
1361 {   1361 {
1362     1362  
1363     1363  
1364   {   1364   {
1365   return ((unsigned int )((__dev & 255ULL) | (unsigned long long )((unsigned int )(__dev >> 12) & 4294967040U)));   1365   return ((unsigned int )((__dev & 255ULL) | (unsigned long long )((unsigned int )(__dev >> 12) & 4294967040U)));
1366 }   1366 }
1367 }   1367 }
1368 __inline extern  __attribute__((__nothrow__)) unsigned long long gnu_dev_makedev(unsigned int __major ,   1368 __inline extern  __attribute__((__nothrow__)) unsigned long long gnu_dev_makedev(unsigned int __major ,
1369                                                                                  unsigned int __minor ) ;   1369                                                                                  unsigned int __minor ) ;
1370 __inline extern unsigned long long gnu_dev_makedev(unsigned int __major ,   1370 __inline extern unsigned long long gnu_dev_makedev(unsigned int __major ,
1371                                                    unsigned int __minor )   1371                                                    unsigned int __minor )
1372 {   1372 {
1373     1373  
1374     1374  
1375   {   1375   {
1376   return (((unsigned long long )((__minor & 255U) | ((__major & 4095U) << 8)) | ((unsigned long long )(__minor & 4294967040U) << 12)) | ((unsigned long long )(__major & 4294963200U) << 32));   1376   return (((unsigned long long )((__minor & 255U) | ((__major & 4095U) << 8)) | ((unsigned long long )(__minor & 4294967040U) << 12)) | ((unsigned long long )(__major & 4294963200U) << 32));
1377 }   1377 }
1378 }   1378 }
1379 extern int fcntl(int __fd , int __cmd  , ...) ;   1379 extern int fcntl(int __fd , int __cmd  , ...) ;
1380 extern int ( __attribute__((__nonnull__(1))) open)(char const   *__file ,   1380 extern int ( __attribute__((__nonnull__(1))) open)(char const   *__file ,
1381                                                    int __oflag  , ...)  __asm__("open64")  ;   1381                                                    int __oflag  , ...)  __asm__("open64")  ;
1382 extern int ( __attribute__((__nonnull__(2))) openat)(int __fd ,   1382 extern int ( __attribute__((__nonnull__(2))) openat)(int __fd ,
1383                                                      char const   *__file ,   1383                                                      char const   *__file ,
1384                                                      int __oflag  , ...)  __asm__("openat64")  ;   1384                                                      int __oflag  , ...)  __asm__("openat64")  ;
1385 extern int ( __attribute__((__nonnull__(1))) creat)(char const   *__file ,   1385 extern int ( __attribute__((__nonnull__(1))) creat)(char const   *__file ,
1386                                                     __mode_t __mode )  __asm__("creat64")  ;   1386                                                     __mode_t __mode )  __asm__("creat64")  ;
1387 extern int lockf(int __fd , int __cmd , __off64_t __len )  __asm__("lockf64")  ;   1387 extern int lockf(int __fd , int __cmd , __off64_t __len )  __asm__("lockf64")  ;
1388 extern  __attribute__((__nothrow__)) int posix_fadvise(int __fd ,   1388 extern  __attribute__((__nothrow__)) int posix_fadvise(int __fd ,
1389                                                        __off64_t __offset ,   1389                                                        __off64_t __offset ,
1390                                                        __off64_t __len ,   1390                                                        __off64_t __len ,
1391                                                        int __advise )  __asm__("posix_fadvise64")  ;   1391                                                        int __advise )  __asm__("posix_fadvise64")  ;
1392 extern int posix_fallocate(int __fd , __off64_t __offset , __off64_t __len )  __asm__("posix_fallocate64")  ;   1392 extern int posix_fallocate(int __fd , __off64_t __offset , __off64_t __len )  __asm__("posix_fallocate64")  ;
1393 extern  __attribute__((__nothrow__)) void *( __attribute__((__nonnull__(1,2))) memcpy)(void * __restrict  __dest ,   1393 extern  __attribute__((__nothrow__)) void *( __attribute__((__nonnull__(1,2))) memcpy)(void * __restrict  __dest ,
1394                                                                                        void const   * __restrict  __src ,   1394                                                                                        void const   * __restrict  __src ,
1395                                                                                        size_t __n ) ;   1395                                                                                        size_t __n ) ;
1396 extern  __attribute__((__nothrow__)) void *( __attribute__((__nonnull__(1,2))) memmove)(void *__dest ,   1396 extern  __attribute__((__nothrow__)) void *( __attribute__((__nonnull__(1,2))) memmove)(void *__dest ,
1397                                                                                         void const   *__src ,   1397                                                                                         void const   *__src ,
1398                                                                                         size_t __n ) ;   1398                                                                                         size_t __n ) ;
1399 extern  __attribute__((__nothrow__)) void *( __attribute__((__nonnull__(1,2))) memccpy)(void * __restrict  __dest ,   1399 extern  __attribute__((__nothrow__)) void *( __attribute__((__nonnull__(1,2))) memccpy)(void * __restrict  __dest ,
1400                                                                                         void const   * __restrict  __src ,   1400                                                                                         void const   * __restrict  __src ,
1401                                                                                         int __c ,   1401                                                                                         int __c ,
1402                                                                                         size_t __n ) ;   1402                                                                                         size_t __n ) ;
1403 extern  __attribute__((__nothrow__)) void *( __attribute__((__nonnull__(1))) memset)(void *__s ,   1403 extern  __attribute__((__nothrow__)) void *( __attribute__((__nonnull__(1))) memset)(void *__s ,
1404                                                                                      int __c ,   1404                                                                                      int __c ,
1405                                                                                      size_t __n ) ;   1405                                                                                      size_t __n ) ;
1406 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) memcmp)(void const   *__s1 ,   1406 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) memcmp)(void const   *__s1 ,
1407                                                                                      void const   *__s2 ,   1407                                                                                      void const   *__s2 ,
1408                                                                                      size_t __n )  __attribute__((__pure__)) ;   1408                                                                                      size_t __n )  __attribute__((__pure__)) ;
1409 extern  __attribute__((__nothrow__)) void *( __attribute__((__nonnull__(1))) memchr)(void const   *__s ,   1409 extern  __attribute__((__nothrow__)) void *( __attribute__((__nonnull__(1))) memchr)(void const   *__s ,
1410                                                                                      int __c ,   1410                                                                                      int __c ,
1411                                                                                      size_t __n )  __attribute__((__pure__)) ;   1411                                                                                      size_t __n )  __attribute__((__pure__)) ;
1412 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1,2))) strcpy)(char * __restrict  __dest ,   1412 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1,2))) strcpy)(char * __restrict  __dest ,
1413                                                                                        char const   * __restrict  __src ) ;   1413                                                                                        char const   * __restrict  __src ) ;
1414 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1,2))) strncpy)(char * __restrict  __dest ,   1414 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1,2))) strncpy)(char * __restrict  __dest ,
1415                                                                                         char const   * __restrict  __src ,   1415                                                                                         char const   * __restrict  __src ,
1416                                                                                         size_t __n ) ;   1416                                                                                         size_t __n ) ;
1417 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1,2))) strcat)(char * __restrict  __dest ,   1417 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1,2))) strcat)(char * __restrict  __dest ,
1418                                                                                        char const   * __restrict  __src ) ;   1418                                                                                        char const   * __restrict  __src ) ;
1419 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1,2))) strncat)(char * __restrict  __dest ,   1419 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1,2))) strncat)(char * __restrict  __dest ,
1420                                                                                         char const   * __restrict  __src ,   1420                                                                                         char const   * __restrict  __src ,
1421                                                                                         size_t __n ) ;   1421                                                                                         size_t __n ) ;
1422 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) strcmp)(char const   *__s1 ,   1422 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) strcmp)(char const   *__s1 ,
1423                                                                                      char const   *__s2 )  __attribute__((__pure__)) ;   1423                                                                                      char const   *__s2 )  __attribute__((__pure__)) ;
1424 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) strncmp)(char const   *__s1 ,   1424 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) strncmp)(char const   *__s1 ,
1425                                                                                       char const   *__s2 ,   1425                                                                                       char const   *__s2 ,
1426                                                                                       size_t __n )  __attribute__((__pure__)) ;   1426                                                                                       size_t __n )  __attribute__((__pure__)) ;
1427 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) strcoll)(char const   *__s1 ,   1427 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) strcoll)(char const   *__s1 ,
1428                                                                                       char const   *__s2 )  __attribute__((__pure__)) ;   1428                                                                                       char const   *__s2 )  __attribute__((__pure__)) ;
1429 extern  __attribute__((__nothrow__)) size_t ( __attribute__((__nonnull__(2))) strxfrm)(char * __restrict  __dest ,   1429 extern  __attribute__((__nothrow__)) size_t ( __attribute__((__nonnull__(2))) strxfrm)(char * __restrict  __dest ,
1430                                                                                        char const   * __restrict  __src ,   1430                                                                                        char const   * __restrict  __src ,
1431                                                                                        size_t __n ) ;   1431                                                                                        size_t __n ) ;
1432 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2,3))) strcoll_l)(char const   *__s1 ,   1432 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2,3))) strcoll_l)(char const   *__s1 ,
1433                                                                                           char const   *__s2 ,   1433                                                                                           char const   *__s2 ,
1434                                                                                           __locale_t __l )  __attribute__((__pure__)) ;   1434                                                                                           __locale_t __l )  __attribute__((__pure__)) ;
1435 extern  __attribute__((__nothrow__)) size_t ( __attribute__((__nonnull__(2,4))) strxfrm_l)(char *__dest ,   1435 extern  __attribute__((__nothrow__)) size_t ( __attribute__((__nonnull__(2,4))) strxfrm_l)(char *__dest ,
1436                                                                                            char const   *__src ,   1436                                                                                            char const   *__src ,
1437                                                                                            size_t __n ,   1437                                                                                            size_t __n ,
1438                                                                                            __locale_t __l ) ;   1438                                                                                            __locale_t __l ) ;
1439 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1))) strdup)(char const   *__s )  __attribute__((__malloc__)) ;   1439 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1))) strdup)(char const   *__s )  __attribute__((__malloc__)) ;
1440 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1))) strndup)(char const   *__string ,   1440 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1))) strndup)(char const   *__string ,
1441                                                                                       size_t __n )  __attribute__((__malloc__)) ;   1441                                                                                       size_t __n )  __attribute__((__malloc__)) ;
1442 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1))) strchr)(char const   *__s ,   1442 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1))) strchr)(char const   *__s ,
1443                                                                                      int __c )  __attribute__((__pure__)) ;   1443                                                                                      int __c )  __attribute__((__pure__)) ;
1444 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1))) strrchr)(char const   *__s ,   1444 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1))) strrchr)(char const   *__s ,
1445                                                                                       int __c )  __attribute__((__pure__)) ;   1445                                                                                       int __c )  __attribute__((__pure__)) ;
1446 extern  __attribute__((__nothrow__)) size_t ( __attribute__((__nonnull__(1,2))) strcspn)(char const   *__s ,   1446 extern  __attribute__((__nothrow__)) size_t ( __attribute__((__nonnull__(1,2))) strcspn)(char const   *__s ,
1447                                                                                          char const   *__reject )  __attribute__((__pure__)) ;   1447                                                                                          char const   *__reject )  __attribute__((__pure__)) ;
1448 extern  __attribute__((__nothrow__)) size_t ( __attribute__((__nonnull__(1,2))) strspn)(char const   *__s ,   1448 extern  __attribute__((__nothrow__)) size_t ( __attribute__((__nonnull__(1,2))) strspn)(char const   *__s ,
1449                                                                                         char const   *__accept )  __attribute__((__pure__)) ;   1449                                                                                         char const   *__accept )  __attribute__((__pure__)) ;
1450 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1,2))) strpbrk)(char const   *__s ,   1450 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1,2))) strpbrk)(char const   *__s ,
1451                                                                                         char const   *__accept )  __attribute__((__pure__)) ;   1451                                                                                         char const   *__accept )  __attribute__((__pure__)) ;
1452 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1,2))) strstr)(char const   *__haystack ,   1452 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1,2))) strstr)(char const   *__haystack ,
1453                                                                                        char const   *__needle )  __attribute__((__pure__)) ;   1453                                                                                        char const   *__needle )  __attribute__((__pure__)) ;
1454 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(2))) strtok)(char * __restrict  __s ,   1454 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(2))) strtok)(char * __restrict  __s ,
1455                                                                                      char const   * __restrict  __delim ) ;   1455                                                                                      char const   * __restrict  __delim ) ;
1456 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(2,3))) __strtok_r)(char * __restrict  __s ,   1456 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(2,3))) __strtok_r)(char * __restrict  __s ,
1457                                                                                            char const   * __restrict  __delim ,   1457                                                                                            char const   * __restrict  __delim ,
1458                                                                                            char ** __restrict  __save_ptr ) ;   1458                                                                                            char ** __restrict  __save_ptr ) ;
1459 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(2,3))) strtok_r)(char * __restrict  __s ,   1459 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(2,3))) strtok_r)(char * __restrict  __s ,
1460                                                                                          char const   * __restrict  __delim ,   1460                                                                                          char const   * __restrict  __delim ,
1461                                                                                          char ** __restrict  __save_ptr ) ;   1461                                                                                          char ** __restrict  __save_ptr ) ;
1462 extern  __attribute__((__nothrow__)) size_t ( __attribute__((__nonnull__(1))) strlen)(char const   *__s )  __attribute__((__pure__)) ;   1462 extern  __attribute__((__nothrow__)) size_t ( __attribute__((__nonnull__(1))) strlen)(char const   *__s )  __attribute__((__pure__)) ;
1463 extern  __attribute__((__nothrow__)) size_t ( __attribute__((__nonnull__(1))) strnlen)(char const   *__string ,   1463 extern  __attribute__((__nothrow__)) size_t ( __attribute__((__nonnull__(1))) strnlen)(char const   *__string ,
1464                                                                                        size_t __maxlen )  __attribute__((__pure__)) ;   1464                                                                                        size_t __maxlen )  __attribute__((__pure__)) ;
1465 extern  __attribute__((__nothrow__)) char *strerror(int __errnum ) ;   1465 extern  __attribute__((__nothrow__)) char *strerror(int __errnum ) ;
1466 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) strerror_r)(int __errnum ,   1466 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) strerror_r)(int __errnum ,
1467                                                                                        char *__buf ,   1467                                                                                        char *__buf ,
1468                                                                                        size_t __buflen )  __asm__("__xpg_strerror_r")  ;   1468                                                                                        size_t __buflen )  __asm__("__xpg_strerror_r")  ;
1469 extern  __attribute__((__nothrow__)) char *strerror_l(int __errnum ,   1469 extern  __attribute__((__nothrow__)) char *strerror_l(int __errnum ,
1470                                                       __locale_t __l ) ;   1470                                                       __locale_t __l ) ;
1471 extern  __attribute__((__nothrow__)) void ( __attribute__((__nonnull__(1))) __bzero)(void *__s ,   1471 extern  __attribute__((__nothrow__)) void ( __attribute__((__nonnull__(1))) __bzero)(void *__s ,
1472                                                                                      size_t __n ) ;   1472                                                                                      size_t __n ) ;
1473 extern  __attribute__((__nothrow__)) void ( __attribute__((__nonnull__(1,2))) bcopy)(void const   *__src ,   1473 extern  __attribute__((__nothrow__)) void ( __attribute__((__nonnull__(1,2))) bcopy)(void const   *__src ,
1474                                                                                      void *__dest ,   1474                                                                                      void *__dest ,
1475                                                                                      size_t __n ) ;   1475                                                                                      size_t __n ) ;
1476 extern  __attribute__((__nothrow__)) void ( __attribute__((__nonnull__(1))) bzero)(void *__s ,   1476 extern  __attribute__((__nothrow__)) void ( __attribute__((__nonnull__(1))) bzero)(void *__s ,
1477                                                                                    size_t __n ) ;   1477                                                                                    size_t __n ) ;
1478 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) bcmp)(void const   *__s1 ,   1478 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) bcmp)(void const   *__s1 ,
1479                                                                                    void const   *__s2 ,   1479                                                                                    void const   *__s2 ,
1480                                                                                    size_t __n )  __attribute__((__pure__)) ;   1480                                                                                    size_t __n )  __attribute__((__pure__)) ;
1481 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1))) index)(char const   *__s ,   1481 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1))) index)(char const   *__s ,
1482                                                                                     int __c )  __attribute__((__pure__)) ;   1482                                                                                     int __c )  __attribute__((__pure__)) ;
1483 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1))) rindex)(char const   *__s ,   1483 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1))) rindex)(char const   *__s ,
1484                                                                                      int __c )  __attribute__((__pure__)) ;   1484                                                                                      int __c )  __attribute__((__pure__)) ;
1485 extern  __attribute__((__nothrow__)) int ffs(int __i )  __attribute__((__const__)) ;   1485 extern  __attribute__((__nothrow__)) int ffs(int __i )  __attribute__((__const__)) ;
1486 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) strcasecmp)(char const   *__s1 ,   1486 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) strcasecmp)(char const   *__s1 ,
1487                                                                                          char const   *__s2 )  __attribute__((__pure__)) ;   1487                                                                                          char const   *__s2 )  __attribute__((__pure__)) ;
1488 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) strncasecmp)(char const   *__s1 ,   1488 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) strncasecmp)(char const   *__s1 ,
1489                                                                                           char const   *__s2 ,   1489                                                                                           char const   *__s2 ,
1490                                                                                           size_t __n )  __attribute__((__pure__)) ;   1490                                                                                           size_t __n )  __attribute__((__pure__)) ;
1491 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1,2))) strsep)(char ** __restrict  __stringp ,   1491 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1,2))) strsep)(char ** __restrict  __stringp ,
1492                                                                                        char const   * __restrict  __delim ) ;   1492                                                                                        char const   * __restrict  __delim ) ;
1493 extern  __attribute__((__nothrow__)) char *strsignal(int __sig ) ;   1493 extern  __attribute__((__nothrow__)) char *strsignal(int __sig ) ;
1494 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1,2))) __stpcpy)(char * __restrict  __dest ,   1494 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1,2))) __stpcpy)(char * __restrict  __dest ,
1495                                                                                          char const   * __restrict  __src ) ;   1495                                                                                          char const   * __restrict  __src ) ;
1496 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1,2))) stpcpy)(char * __restrict  __dest ,   1496 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1,2))) stpcpy)(char * __restrict  __dest ,
1497                                                                                        char const   * __restrict  __src ) ;   1497                                                                                        char const   * __restrict  __src ) ;
1498 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1,2))) __stpncpy)(char * __restrict  __dest ,   1498 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1,2))) __stpncpy)(char * __restrict  __dest ,
1499                                                                                           char const   * __restrict  __src ,   1499                                                                                           char const   * __restrict  __src ,
1500                                                                                           size_t __n ) ;   1500                                                                                           size_t __n ) ;
1501 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1,2))) stpncpy)(char * __restrict  __dest ,   1501 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1,2))) stpncpy)(char * __restrict  __dest ,
1502                                                                                         char const   * __restrict  __src ,   1502                                                                                         char const   * __restrict  __src ,
1503                                                                                         size_t __n ) ;   1503                                                                                         size_t __n ) ;
1504 extern void *__rawmemchr(void const   *__s , int __c ) ;   1504 extern void *__rawmemchr(void const   *__s , int __c ) ;
1505 __inline extern size_t __strcspn_c1(char const   *__s , int __reject ) ;   1505 __inline extern size_t __strcspn_c1(char const   *__s , int __reject ) ;
1506 __inline extern size_t __strcspn_c1(char const   *__s , int __reject )   1506 __inline extern size_t __strcspn_c1(char const   *__s , int __reject )
1507 {   1507 {
1508   register size_t __result ;   1508   register size_t __result ;
1509     1509  
1510   {   1510   {
1511   __result = (size_t )0;   1511   __result = (size_t )0;
1512   while (1) {   1512   while (1) {
1513     if ((int const   )*(__s + __result) != 0) {   1513     if ((int const   )*(__s + __result) != 0) {
1514       if ((int const   )*(__s + __result) != (int const   )__reject) {   1514       if ((int const   )*(__s + __result) != (int const   )__reject) {
1515     1515  
1516       } else {   1516       } else {
1517         break;   1517         break;
1518       }   1518       }
1519     } else {   1519     } else {
1520       break;   1520       break;
1521     }   1521     }
1522     __result ++;   1522     __result ++;
1523   }   1523   }
1524   return (__result);   1524   return (__result);
1525 }   1525 }
1526 }   1526 }
1527 __inline extern size_t __strcspn_c2(char const   *__s , int __reject1 ,   1527 __inline extern size_t __strcspn_c2(char const   *__s , int __reject1 ,
1528                                     int __reject2 ) ;   1528                                     int __reject2 ) ;
1529 __inline extern size_t __strcspn_c2(char const   *__s , int __reject1 ,   1529 __inline extern size_t __strcspn_c2(char const   *__s , int __reject1 ,
1530                                     int __reject2 )   1530                                     int __reject2 )
1531 {   1531 {
1532   register size_t __result ;   1532   register size_t __result ;
1533     1533  
1534   {   1534   {
1535   __result = (size_t )0;   1535   __result = (size_t )0;
1536   while (1) {   1536   while (1) {
1537     if ((int const   )*(__s + __result) != 0) {   1537     if ((int const   )*(__s + __result) != 0) {
1538       if ((int const   )*(__s + __result) != (int const   )__reject1) {   1538       if ((int const   )*(__s + __result) != (int const   )__reject1) {
1539         if ((int const   )*(__s + __result) != (int const   )__reject2) {   1539         if ((int const   )*(__s + __result) != (int const   )__reject2) {
1540     1540  
1541         } else {   1541         } else {
1542           break;   1542           break;
1543         }   1543         }
1544       } else {   1544       } else {
1545         break;   1545         break;
1546       }   1546       }
1547     } else {   1547     } else {
1548       break;   1548       break;
1549     }   1549     }
1550     __result ++;   1550     __result ++;
1551   }   1551   }
1552   return (__result);   1552   return (__result);
1553 }   1553 }
1554 }   1554 }
1555 __inline extern size_t __strcspn_c3(char const   *__s , int __reject1 ,   1555 __inline extern size_t __strcspn_c3(char const   *__s , int __reject1 ,
1556                                     int __reject2 , int __reject3 ) ;   1556                                     int __reject2 , int __reject3 ) ;
1557 __inline extern size_t __strcspn_c3(char const   *__s , int __reject1 ,   1557 __inline extern size_t __strcspn_c3(char const   *__s , int __reject1 ,
1558                                     int __reject2 , int __reject3 )   1558                                     int __reject2 , int __reject3 )
1559 {   1559 {
1560   register size_t __result ;   1560   register size_t __result ;
1561     1561  
1562   {   1562   {
1563   __result = (size_t )0;   1563   __result = (size_t )0;
1564   while (1) {   1564   while (1) {
1565     if ((int const   )*(__s + __result) != 0) {   1565     if ((int const   )*(__s + __result) != 0) {
1566       if ((int const   )*(__s + __result) != (int const   )__reject1) {   1566       if ((int const   )*(__s + __result) != (int const   )__reject1) {
1567         if ((int const   )*(__s + __result) != (int const   )__reject2) {   1567         if ((int const   )*(__s + __result) != (int const   )__reject2) {
1568           if ((int const   )*(__s + __result) != (int const   )__reject3) {   1568           if ((int const   )*(__s + __result) != (int const   )__reject3) {
1569     1569  
1570           } else {   1570           } else {
1571             break;   1571             break;
1572           }   1572           }
1573         } else {   1573         } else {
1574           break;   1574           break;
1575         }   1575         }
1576       } else {   1576       } else {
1577         break;   1577         break;
1578       }   1578       }
1579     } else {   1579     } else {
1580       break;   1580       break;
1581     }   1581     }
1582     __result ++;   1582     __result ++;
1583   }   1583   }
1584   return (__result);   1584   return (__result);
1585 }   1585 }
1586 }   1586 }
1587 __inline extern size_t __strspn_c1(char const   *__s , int __accept ) ;   1587 __inline extern size_t __strspn_c1(char const   *__s , int __accept ) ;
1588 __inline extern size_t __strspn_c1(char const   *__s , int __accept )   1588 __inline extern size_t __strspn_c1(char const   *__s , int __accept )
1589 {   1589 {
1590   register size_t __result ;   1590   register size_t __result ;
1591     1591  
1592   {   1592   {
1593   __result = (size_t )0;   1593   __result = (size_t )0;
1594   while ((int const   )*(__s + __result) == (int const   )__accept) {   1594   while ((int const   )*(__s + __result) == (int const   )__accept) {
1595     __result ++;   1595     __result ++;
1596   }   1596   }
1597   return (__result);   1597   return (__result);
1598 }   1598 }
1599 }   1599 }
1600 __inline extern size_t __strspn_c2(char const   *__s , int __accept1 ,   1600 __inline extern size_t __strspn_c2(char const   *__s , int __accept1 ,
1601                                    int __accept2 ) ;   1601                                    int __accept2 ) ;
1602 __inline extern size_t __strspn_c2(char const   *__s , int __accept1 ,   1602 __inline extern size_t __strspn_c2(char const   *__s , int __accept1 ,
1603                                    int __accept2 )   1603                                    int __accept2 )
1604 {   1604 {
1605   register size_t __result ;   1605   register size_t __result ;
1606     1606  
1607   {   1607   {
1608   __result = (size_t )0;   1608   __result = (size_t )0;
1609   while (1) {   1609   while (1) {
1610     if ((int const   )*(__s + __result) == (int const   )__accept1) {   1610     if ((int const   )*(__s + __result) == (int const   )__accept1) {
1611     1611  
1612     } else   1612     } else
1613     if ((int const   )*(__s + __result) == (int const   )__accept2) {   1613     if ((int const   )*(__s + __result) == (int const   )__accept2) {
1614     1614  
1615     } else {   1615     } else {
1616       break;   1616       break;
1617     }   1617     }
1618     __result ++;   1618     __result ++;
1619   }   1619   }
1620   return (__result);   1620   return (__result);
1621 }   1621 }
1622 }   1622 }
1623 __inline extern size_t __strspn_c3(char const   *__s , int __accept1 ,   1623 __inline extern size_t __strspn_c3(char const   *__s , int __accept1 ,
1624                                    int __accept2 , int __accept3 ) ;   1624                                    int __accept2 , int __accept3 ) ;
1625 __inline extern size_t __strspn_c3(char const   *__s , int __accept1 ,   1625 __inline extern size_t __strspn_c3(char const   *__s , int __accept1 ,
1626                                    int __accept2 , int __accept3 )   1626                                    int __accept2 , int __accept3 )
1627 {   1627 {
1628   register size_t __result ;   1628   register size_t __result ;
1629     1629  
1630   {   1630   {
1631   __result = (size_t )0;   1631   __result = (size_t )0;
1632   while (1) {   1632   while (1) {
1633     if ((int const   )*(__s + __result) == (int const   )__accept1) {   1633     if ((int const   )*(__s + __result) == (int const   )__accept1) {
1634     1634  
1635     } else   1635     } else
1636     if ((int const   )*(__s + __result) == (int const   )__accept2) {   1636     if ((int const   )*(__s + __result) == (int const   )__accept2) {
1637     1637  
1638     } else   1638     } else
1639     if ((int const   )*(__s + __result) == (int const   )__accept3) {   1639     if ((int const   )*(__s + __result) == (int const   )__accept3) {
1640     1640  
1641     } else {   1641     } else {
1642       break;   1642       break;
1643     }   1643     }
1644     __result ++;   1644     __result ++;
1645   }   1645   }
1646   return (__result);   1646   return (__result);
1647 }   1647 }
1648 }   1648 }
1649 __inline extern char *__strpbrk_c2(char const   *__s , int __accept1 ,   1649 __inline extern char *__strpbrk_c2(char const   *__s , int __accept1 ,
1650                                    int __accept2 ) ;   1650                                    int __accept2 ) ;
1651 __inline extern char *__strpbrk_c2(char const   *__s , int __accept1 ,   1651 __inline extern char *__strpbrk_c2(char const   *__s , int __accept1 ,
1652                                    int __accept2 )   1652                                    int __accept2 )
1653 {   1653 {
1654   char *tmp ;   1654   char *tmp ;
1655     1655  
1656   {   1656   {
1657   while (1) {   1657   while (1) {
1658     if ((int const   )*__s != 0) {   1658     if ((int const   )*__s != 0) {
1659       if ((int const   )*__s != (int const   )__accept1) {   1659       if ((int const   )*__s != (int const   )__accept1) {
1660         if ((int const   )*__s != (int const   )__accept2) {   1660         if ((int const   )*__s != (int const   )__accept2) {
1661     1661  
1662         } else {   1662         } else {
1663           break;   1663           break;
1664         }   1664         }
1665       } else {   1665       } else {
1666         break;   1666         break;
1667       }   1667       }
1668     } else {   1668     } else {
1669       break;   1669       break;
1670     }   1670     }
1671     __s ++;   1671     __s ++;
1672   }   1672   }
1673   if ((int const   )*__s == 0) {   1673   if ((int const   )*__s == 0) {
1674     tmp = (char *)((void *)0);   1674     tmp = (char *)((void *)0);
1675   } else {   1675   } else {
1676     tmp = (char *)((size_t )__s);   1676     tmp = (char *)((size_t )__s);
1677   }   1677   }
1678   return (tmp);   1678   return (tmp);
1679 }   1679 }
1680 }   1680 }
1681 __inline extern char *__strpbrk_c3(char const   *__s , int __accept1 ,   1681 __inline extern char *__strpbrk_c3(char const   *__s , int __accept1 ,
1682                                    int __accept2 , int __accept3 ) ;   1682                                    int __accept2 , int __accept3 ) ;
1683 __inline extern char *__strpbrk_c3(char const   *__s , int __accept1 ,   1683 __inline extern char *__strpbrk_c3(char const   *__s , int __accept1 ,
1684                                    int __accept2 , int __accept3 )   1684                                    int __accept2 , int __accept3 )
1685 {   1685 {
1686   char *tmp ;   1686   char *tmp ;
1687     1687  
1688   {   1688   {
1689   while (1) {   1689   while (1) {
1690     if ((int const   )*__s != 0) {   1690     if ((int const   )*__s != 0) {
1691       if ((int const   )*__s != (int const   )__accept1) {   1691       if ((int const   )*__s != (int const   )__accept1) {
1692         if ((int const   )*__s != (int const   )__accept2) {   1692         if ((int const   )*__s != (int const   )__accept2) {
1693           if ((int const   )*__s != (int const   )__accept3) {   1693           if ((int const   )*__s != (int const   )__accept3) {
1694     1694  
1695           } else {   1695           } else {
1696             break;   1696             break;
1697           }   1697           }
1698         } else {   1698         } else {
1699           break;   1699           break;
1700         }   1700         }
1701       } else {   1701       } else {
1702         break;   1702         break;
1703       }   1703       }
1704     } else {   1704     } else {
1705       break;   1705       break;
1706     }   1706     }
1707     __s ++;   1707     __s ++;
1708   }   1708   }
1709   if ((int const   )*__s == 0) {   1709   if ((int const   )*__s == 0) {
1710     tmp = (char *)((void *)0);   1710     tmp = (char *)((void *)0);
1711   } else {   1711   } else {
1712     tmp = (char *)((size_t )__s);   1712     tmp = (char *)((size_t )__s);
1713   }   1713   }
1714   return (tmp);   1714   return (tmp);
1715 }   1715 }
1716 }   1716 }
1717 __inline extern char *__strtok_r_1c(char *__s , char __sep , char **__nextp ) ;   1717 __inline extern char *__strtok_r_1c(char *__s , char __sep , char **__nextp ) ;
1718 __inline extern char *__strtok_r_1c(char *__s , char __sep , char **__nextp )   1718 __inline extern char *__strtok_r_1c(char *__s , char __sep , char **__nextp )
1719 {   1719 {
1720   char *__result ;   1720   char *__result ;
1721   char *tmp ;   1721   char *tmp ;
1722   char *tmp___0 ;   1722   char *tmp___0 ;
1723     1723  
1724   {   1724   {
1725   if ((unsigned int )__s == (unsigned int )((void *)0)) {   1725   if ((unsigned int )__s == (unsigned int )((void *)0)) {
1726     __s = *__nextp;   1726     __s = *__nextp;
1727   } else {   1727   } else {
1728     1728  
1729   }   1729   }
1730   while ((int )*__s == (int )__sep) {   1730   while ((int )*__s == (int )__sep) {
1731     __s ++;   1731     __s ++;
1732   }   1732   }
1733   __result = (char *)((void *)0);   1733   __result = (char *)((void *)0);
1734   if ((int )*__s != 0) {   1734   if ((int )*__s != 0) {
1735     tmp = __s;   1735     tmp = __s;
1736     __s ++;   1736     __s ++;
1737     __result = tmp;   1737     __result = tmp;
1738     while ((int )*__s != 0) {   1738     while ((int )*__s != 0) {
1739       tmp___0 = __s;   1739       tmp___0 = __s;
1740       __s ++;   1740       __s ++;
1741       if ((int )*tmp___0 == (int )__sep) {   1741       if ((int )*tmp___0 == (int )__sep) {
1742         *(__s + -1) = (char )'\000';   1742         *(__s + -1) = (char )'\000';
1743         break;   1743         break;
1744       } else {   1744       } else {
1745     1745  
1746       }   1746       }
1747     }   1747     }
1748   } else {   1748   } else {
1749     1749  
1750   }   1750   }
1751   *__nextp = __s;   1751   *__nextp = __s;
1752   return (__result);   1752   return (__result);
1753 }   1753 }
1754 }   1754 }
1755 extern char *__strsep_g(char **__stringp , char const   *__delim ) ;   1755 extern char *__strsep_g(char **__stringp , char const   *__delim ) ;
1756 __inline extern char *__strsep_1c(char **__s , char __reject ) ;   1756 __inline extern char *__strsep_1c(char **__s , char __reject ) ;
1757 __inline extern char *__strsep_1c(char **__s , char __reject )   1757 __inline extern char *__strsep_1c(char **__s , char __reject )
1758 {   1758 {
1759   register char *__retval ;   1759   register char *__retval ;
1760   char *tmp ;   1760   char *tmp ;
1761   char *tmp___0 ;   1761   char *tmp___0 ;
1762   void *tmp___1 ;   1762   void *tmp___1 ;
1763   char *tmp___2 ;   1763   char *tmp___2 ;
1764     1764  
1765   {   1765   {
1766   __retval = *__s;   1766   __retval = *__s;
1767   if ((unsigned int )__retval != (unsigned int )((void *)0)) {   1767   if ((unsigned int )__retval != (unsigned int )((void *)0)) {
1768     tmp___2 = __builtin_strchr(__retval, (int )__reject);   1768     tmp___2 = __builtin_strchr(__retval, (int )__reject);
1769     tmp___0 = tmp___2;   1769     tmp___0 = tmp___2;
1770     *__s = tmp___0;   1770     *__s = tmp___0;
1771     if ((unsigned int )tmp___0 != (unsigned int )((void *)0)) {   1771     if ((unsigned int )tmp___0 != (unsigned int )((void *)0)) {
1772       tmp = *__s;   1772       tmp = *__s;
1773       (*__s) ++;   1773       (*__s) ++;
1774       *tmp = (char )'\000';   1774       *tmp = (char )'\000';
1775     } else {   1775     } else {
1776     1776  
1777     }   1777     }
1778   } else {   1778   } else {
1779     1779  
1780   }   1780   }
1781   return (__retval);   1781   return (__retval);
1782 }   1782 }
1783 }   1783 }
1784 __inline extern char *__strsep_2c(char **__s , char __reject1 , char __reject2 ) ;   1784 __inline extern char *__strsep_2c(char **__s , char __reject1 , char __reject2 ) ;
1785 __inline extern char *__strsep_2c(char **__s , char __reject1 , char __reject2 )   1785 __inline extern char *__strsep_2c(char **__s , char __reject1 , char __reject2 )
1786 {   1786 {
1787   register char *__retval ;   1787   register char *__retval ;
1788   register char *__cp ;   1788   register char *__cp ;
1789   char *tmp ;   1789   char *tmp ;
1790     1790  
1791   {   1791   {
1792   __retval = *__s;   1792   __retval = *__s;
1793   if ((unsigned int )__retval != (unsigned int )((void *)0)) {   1793   if ((unsigned int )__retval != (unsigned int )((void *)0)) {
1794     __cp = __retval;   1794     __cp = __retval;
1795     while (1) {   1795     while (1) {
1796       if ((int )*__cp == 0) {   1796       if ((int )*__cp == 0) {
1797         __cp = (char *)((void *)0);   1797         __cp = (char *)((void *)0);
1798         break;   1798         break;
1799       } else {   1799       } else {
1800     1800  
1801       }   1801       }
1802       if ((int )*__cp == (int )__reject1) {   1802       if ((int )*__cp == (int )__reject1) {
1803         tmp = __cp;   1803         tmp = __cp;
1804         __cp ++;   1804         __cp ++;
1805         *tmp = (char )'\000';   1805         *tmp = (char )'\000';
1806         break;   1806         break;
1807       } else   1807       } else
1808       if ((int )*__cp == (int )__reject2) {   1808       if ((int )*__cp == (int )__reject2) {
1809         tmp = __cp;   1809         tmp = __cp;
1810         __cp ++;   1810         __cp ++;
1811         *tmp = (char )'\000';   1811         *tmp = (char )'\000';
1812         break;   1812         break;
1813       } else {   1813       } else {
1814     1814  
1815       }   1815       }
1816       __cp ++;   1816       __cp ++;
1817     }   1817     }
1818     *__s = __cp;   1818     *__s = __cp;
1819   } else {   1819   } else {
1820     1820  
1821   }   1821   }
1822   return (__retval);   1822   return (__retval);
1823 }   1823 }
1824 }   1824 }
1825 __inline extern char *__strsep_3c(char **__s , char __reject1 , char __reject2 ,   1825 __inline extern char *__strsep_3c(char **__s , char __reject1 , char __reject2 ,
1826                                   char __reject3 ) ;   1826                                   char __reject3 ) ;
1827 __inline extern char *__strsep_3c(char **__s , char __reject1 , char __reject2 ,   1827 __inline extern char *__strsep_3c(char **__s , char __reject1 , char __reject2 ,
1828                                   char __reject3 )   1828                                   char __reject3 )
1829 {   1829 {
1830   register char *__retval ;   1830   register char *__retval ;
1831   register char *__cp ;   1831   register char *__cp ;
1832   char *tmp ;   1832   char *tmp ;
1833     1833  
1834   {   1834   {
1835   __retval = *__s;   1835   __retval = *__s;
1836   if ((unsigned int )__retval != (unsigned int )((void *)0)) {   1836   if ((unsigned int )__retval != (unsigned int )((void *)0)) {
1837     __cp = __retval;   1837     __cp = __retval;
1838     while (1) {   1838     while (1) {
1839       if ((int )*__cp == 0) {   1839       if ((int )*__cp == 0) {
1840         __cp = (char *)((void *)0);   1840         __cp = (char *)((void *)0);
1841         break;   1841         break;
1842       } else {   1842       } else {
1843     1843  
1844       }   1844       }
1845       if ((int )*__cp == (int )__reject1) {   1845       if ((int )*__cp == (int )__reject1) {
1846         tmp = __cp;   1846         tmp = __cp;
1847         __cp ++;   1847         __cp ++;
1848         *tmp = (char )'\000';   1848         *tmp = (char )'\000';
1849         break;   1849         break;
1850       } else   1850       } else
1851       if ((int )*__cp == (int )__reject2) {   1851       if ((int )*__cp == (int )__reject2) {
1852         tmp = __cp;   1852         tmp = __cp;
1853         __cp ++;   1853         __cp ++;
1854         *tmp = (char )'\000';   1854         *tmp = (char )'\000';
1855         break;   1855         break;
1856       } else   1856       } else
1857       if ((int )*__cp == (int )__reject3) {   1857       if ((int )*__cp == (int )__reject3) {
1858         tmp = __cp;   1858         tmp = __cp;
1859         __cp ++;   1859         __cp ++;
1860         *tmp = (char )'\000';   1860         *tmp = (char )'\000';
1861         break;   1861         break;
1862       } else {   1862       } else {
1863     1863  
1864       }   1864       }
1865       __cp ++;   1865       __cp ++;
1866     }   1866     }
1867     *__s = __cp;   1867     *__s = __cp;
1868   } else {   1868   } else {
1869     1869  
1870   }   1870   }
1871   return (__retval);   1871   return (__retval);
1872 }   1872 }
1873 }   1873 }
1874 extern  __attribute__((__nothrow__)) void *malloc(size_t __size )  __attribute__((__malloc__)) ;   1874 extern  __attribute__((__nothrow__)) void *malloc(size_t __size )  __attribute__((__malloc__)) ;
1875 extern  __attribute__((__nothrow__)) void *calloc(size_t __nmemb ,   1875 extern  __attribute__((__nothrow__)) void *calloc(size_t __nmemb ,
1876                                                   size_t __size )  __attribute__((__malloc__)) ;   1876                                                   size_t __size )  __attribute__((__malloc__)) ;
1877 extern  __attribute__((__nothrow__)) char *__strdup(char const   *__string )  __attribute__((__malloc__)) ;   1877 extern  __attribute__((__nothrow__)) char *__strdup(char const   *__string )  __attribute__((__malloc__)) ;
1878 extern  __attribute__((__nothrow__)) char *__strndup(char const   *__string ,   1878 extern  __attribute__((__nothrow__)) char *__strndup(char const   *__string ,
1879                                                      size_t __n )  __attribute__((__malloc__)) ;   1879                                                      size_t __n )  __attribute__((__malloc__)) ;
1880 extern  __attribute__((__nothrow__,   1880 extern  __attribute__((__nothrow__,
1881 __noreturn__)) void __assert_fail(char const   *__assertion ,   1881 __noreturn__)) void __assert_fail(char const   *__assertion ,
1882                                   char const   *__file , unsigned int __line ,   1882                                   char const   *__file , unsigned int __line ,
1883                                   char const   *__function ) ;   1883                                   char const   *__function ) ;
1884 extern  __attribute__((__nothrow__,   1884 extern  __attribute__((__nothrow__,
1885 __noreturn__)) void __assert_perror_fail(int __errnum , char const   *__file ,   1885 __noreturn__)) void __assert_perror_fail(int __errnum , char const   *__file ,
1886                                          unsigned int __line ,   1886                                          unsigned int __line ,
1887                                          char const   *__function ) ;   1887                                          char const   *__function ) ;
1888 extern  __attribute__((__nothrow__,   1888 extern  __attribute__((__nothrow__,
1889 __noreturn__)) void __assert(char const   *__assertion , char const   *__file ,   1889 __noreturn__)) void __assert(char const   *__assertion , char const   *__file ,
1890                              int __line ) ;   1890                              int __line ) ;
1891 extern  __attribute__((__nothrow__)) void insque(void *__elem , void *__prev ) ;   1891 extern  __attribute__((__nothrow__)) void insque(void *__elem , void *__prev ) ;
1892 extern  __attribute__((__nothrow__)) void remque(void *__elem ) ;   1892 extern  __attribute__((__nothrow__)) void remque(void *__elem ) ;
1893 extern  __attribute__((__nothrow__)) ENTRY *hsearch(ENTRY __item ,   1893 extern  __attribute__((__nothrow__)) ENTRY *hsearch(ENTRY __item ,
1894                                                     ACTION __action ) ;   1894                                                     ACTION __action ) ;
1895 extern  __attribute__((__nothrow__)) int hcreate(size_t __nel ) ;   1895 extern  __attribute__((__nothrow__)) int hcreate(size_t __nel ) ;
1896 extern  __attribute__((__nothrow__)) void hdestroy(void) ;   1896 extern  __attribute__((__nothrow__)) void hdestroy(void) ;
1897 extern void *tsearch(void const   *__key , void **__rootp ,   1897 extern void *tsearch(void const   *__key , void **__rootp ,
1898                      int (*__compar)(void const   * , void const   * ) ) ;   1898                      int (*__compar)(void const   * , void const   * ) ) ;
1899 extern void *tfind(void const   *__key , void * const  *__rootp ,   1899 extern void *tfind(void const   *__key , void * const  *__rootp ,
1900                    int (*__compar)(void const   * , void const   * ) ) ;   1900                    int (*__compar)(void const   * , void const   * ) ) ;
1901 extern void *tdelete(void const   * __restrict  __key ,   1901 extern void *tdelete(void const   * __restrict  __key ,
1902                      void ** __restrict  __rootp ,   1902                      void ** __restrict  __rootp ,
1903                      int (*__compar)(void const   * , void const   * ) ) ;   1903                      int (*__compar)(void const   * , void const   * ) ) ;
1904 extern void twalk(void const   *__root ,   1904 extern void twalk(void const   *__root ,
1905                   void (*__action)(void const   *__nodep , VISIT __value ,   1905                   void (*__action)(void const   *__nodep , VISIT __value ,
1906                                    int __level ) ) ;   1906                                    int __level ) ) ;
1907 extern void *lfind(void const   *__key , void const   *__base ,   1907 extern void *lfind(void const   *__key , void const   *__base ,
1908                    size_t *__nmemb , size_t __size ,   1908                    size_t *__nmemb , size_t __size ,
1909                    int (*__compar)(void const   * , void const   * ) ) ;   1909                    int (*__compar)(void const   * , void const   * ) ) ;
1910 extern void *lsearch(void const   *__key , void *__base , size_t *__nmemb ,   1910 extern void *lsearch(void const   *__key , void *__base , size_t *__nmemb ,
1911                      size_t __size , int (*__compar)(void const   * ,   1911                      size_t __size , int (*__compar)(void const   * ,
1912                                                      void const   * ) ) ;   1912                                                      void const   * ) ) ;
1913 extern struct _IO_FILE_plus _IO_2_1_stdin_ ;   1913 extern struct _IO_FILE_plus _IO_2_1_stdin_ ;
1914 extern struct _IO_FILE_plus _IO_2_1_stdout_ ;   1914 extern struct _IO_FILE_plus _IO_2_1_stdout_ ;
1915 extern struct _IO_FILE_plus _IO_2_1_stderr_ ;   1915 extern struct _IO_FILE_plus _IO_2_1_stderr_ ;
1916 extern int __underflow(_IO_FILE * ) ;   1916 extern int __underflow(_IO_FILE * ) ;
1917 extern int __uflow(_IO_FILE * ) ;   1917 extern int __uflow(_IO_FILE * ) ;
1918 extern int __overflow(_IO_FILE * , int  ) ;   1918 extern int __overflow(_IO_FILE * , int  ) ;
1919 extern int _IO_getc(_IO_FILE *__fp ) ;   1919 extern int _IO_getc(_IO_FILE *__fp ) ;
1920 extern int _IO_putc(int __c , _IO_FILE *__fp ) ;   1920 extern int _IO_putc(int __c , _IO_FILE *__fp ) ;
1921 extern  __attribute__((__nothrow__)) int _IO_feof(_IO_FILE *__fp ) ;   1921 extern  __attribute__((__nothrow__)) int _IO_feof(_IO_FILE *__fp ) ;
1922 extern  __attribute__((__nothrow__)) int _IO_ferror(_IO_FILE *__fp ) ;   1922 extern  __attribute__((__nothrow__)) int _IO_ferror(_IO_FILE *__fp ) ;
1923 extern int _IO_peekc_locked(_IO_FILE *__fp ) ;   1923 extern int _IO_peekc_locked(_IO_FILE *__fp ) ;
1924 extern  __attribute__((__nothrow__)) void _IO_flockfile(_IO_FILE * ) ;   1924 extern  __attribute__((__nothrow__)) void _IO_flockfile(_IO_FILE * ) ;
1925 extern  __attribute__((__nothrow__)) void _IO_funlockfile(_IO_FILE * ) ;   1925 extern  __attribute__((__nothrow__)) void _IO_funlockfile(_IO_FILE * ) ;
1926 extern  __attribute__((__nothrow__)) int _IO_ftrylockfile(_IO_FILE * ) ;   1926 extern  __attribute__((__nothrow__)) int _IO_ftrylockfile(_IO_FILE * ) ;
1927 extern int _IO_vfscanf(_IO_FILE * __restrict   , char const   * __restrict   ,   1927 extern int _IO_vfscanf(_IO_FILE * __restrict   , char const   * __restrict   ,
1928                        __gnuc_va_list  , int * __restrict   ) ;   1928                        __gnuc_va_list  , int * __restrict   ) ;
1929 extern int _IO_vfprintf(_IO_FILE * __restrict   , char const   * __restrict   ,   1929 extern int _IO_vfprintf(_IO_FILE * __restrict   , char const   * __restrict   ,
1930                         __gnuc_va_list  ) ;   1930                         __gnuc_va_list  ) ;
1931 extern __ssize_t _IO_padn(_IO_FILE * , int  , __ssize_t  ) ;   1931 extern __ssize_t _IO_padn(_IO_FILE * , int  , __ssize_t  ) ;
1932 extern size_t _IO_sgetn(_IO_FILE * , void * , size_t  ) ;   1932 extern size_t _IO_sgetn(_IO_FILE * , void * , size_t  ) ;
1933 extern __off64_t _IO_seekoff(_IO_FILE * , __off64_t  , int  , int  ) ;   1933 extern __off64_t _IO_seekoff(_IO_FILE * , __off64_t  , int  , int  ) ;
1934 extern __off64_t _IO_seekpos(_IO_FILE * , __off64_t  , int  ) ;   1934 extern __off64_t _IO_seekpos(_IO_FILE * , __off64_t  , int  ) ;
1935 extern  __attribute__((__nothrow__)) void _IO_free_backup_area(_IO_FILE * ) ;   1935 extern  __attribute__((__nothrow__)) void _IO_free_backup_area(_IO_FILE * ) ;
1936 extern struct _IO_FILE *stdin ;   1936 extern struct _IO_FILE *stdin ;
1937 extern struct _IO_FILE *stdout ;   1937 extern struct _IO_FILE *stdout ;
1938 extern struct _IO_FILE *stderr ;   1938 extern struct _IO_FILE *stderr ;
1939 extern  __attribute__((__nothrow__)) int remove(char const   *__filename ) ;   1939 extern  __attribute__((__nothrow__)) int remove(char const   *__filename ) ;
1940 extern  __attribute__((__nothrow__)) int rename(char const   *__old ,   1940 extern  __attribute__((__nothrow__)) int rename(char const   *__old ,
1941                                                 char const   *__new ) ;   1941                                                 char const   *__new ) ;
1942 extern  __attribute__((__nothrow__)) int renameat(int __oldfd ,   1942 extern  __attribute__((__nothrow__)) int renameat(int __oldfd ,
1943                                                   char const   *__old ,   1943                                                   char const   *__old ,
1944                                                   int __newfd ,   1944                                                   int __newfd ,
1945                                                   char const   *__new ) ;   1945                                                   char const   *__new ) ;
1946 extern FILE *tmpfile(void)  __asm__("tmpfile64")  ;   1946 extern FILE *tmpfile(void)  __asm__("tmpfile64")  ;
1947 extern  __attribute__((__nothrow__)) char *tmpnam(char *__s ) ;   1947 extern  __attribute__((__nothrow__)) char *tmpnam(char *__s ) ;
1948 extern  __attribute__((__nothrow__)) char *tmpnam_r(char *__s ) ;   1948 extern  __attribute__((__nothrow__)) char *tmpnam_r(char *__s ) ;
1949 extern  __attribute__((__nothrow__)) char *tempnam(char const   *__dir ,   1949 extern  __attribute__((__nothrow__)) char *tempnam(char const   *__dir ,
1950                                                    char const   *__pfx )  __attribute__((__malloc__)) ;   1950                                                    char const   *__pfx )  __attribute__((__malloc__)) ;
1951 extern int fclose(FILE *__stream ) ;   1951 extern int fclose(FILE *__stream ) ;
1952 extern int fflush(FILE *__stream ) ;   1952 extern int fflush(FILE *__stream ) ;
1953 extern int fflush_unlocked(FILE *__stream ) ;   1953 extern int fflush_unlocked(FILE *__stream ) ;
1954 extern FILE *fopen(char const   * __restrict  __filename ,   1954 extern FILE *fopen(char const   * __restrict  __filename ,
1955                    char const   * __restrict  __modes )  __asm__("fopen64")  ;   1955                    char const   * __restrict  __modes )  __asm__("fopen64")  ;
1956 extern FILE *freopen(char const   * __restrict  __filename ,   1956 extern FILE *freopen(char const   * __restrict  __filename ,
1957                      char const   * __restrict  __modes ,   1957                      char const   * __restrict  __modes ,
1958                      FILE * __restrict  __stream )  __asm__("freopen64")  ;   1958                      FILE * __restrict  __stream )  __asm__("freopen64")  ;
1959 extern  __attribute__((__nothrow__)) FILE *fdopen(int __fd ,   1959 extern  __attribute__((__nothrow__)) FILE *fdopen(int __fd ,
1960                                                   char const   *__modes ) ;   1960                                                   char const   *__modes ) ;
1961 extern  __attribute__((__nothrow__)) FILE *fmemopen(void *__s , size_t __len ,   1961 extern  __attribute__((__nothrow__)) FILE *fmemopen(void *__s , size_t __len ,
1962                                                     char const   *__modes ) ;   1962                                                     char const   *__modes ) ;
1963 extern  __attribute__((__nothrow__)) FILE *open_memstream(char **__bufloc ,   1963 extern  __attribute__((__nothrow__)) FILE *open_memstream(char **__bufloc ,
1964                                                           size_t *__sizeloc ) ;   1964                                                           size_t *__sizeloc ) ;
1965 extern  __attribute__((__nothrow__)) void setbuf(FILE * __restrict  __stream ,   1965 extern  __attribute__((__nothrow__)) void setbuf(FILE * __restrict  __stream ,
1966                                                  char * __restrict  __buf ) ;   1966                                                  char * __restrict  __buf ) ;
1967 extern  __attribute__((__nothrow__)) int setvbuf(FILE * __restrict  __stream ,   1967 extern  __attribute__((__nothrow__)) int setvbuf(FILE * __restrict  __stream ,
1968                                                  char * __restrict  __buf ,   1968                                                  char * __restrict  __buf ,
1969                                                  int __modes , size_t __n ) ;   1969                                                  int __modes , size_t __n ) ;
1970 extern  __attribute__((__nothrow__)) void setbuffer(FILE * __restrict  __stream ,   1970 extern  __attribute__((__nothrow__)) void setbuffer(FILE * __restrict  __stream ,
1971                                                     char * __restrict  __buf ,   1971                                                     char * __restrict  __buf ,
1972                                                     size_t __size ) ;   1972                                                     size_t __size ) ;
1973 extern  __attribute__((__nothrow__)) void setlinebuf(FILE *__stream ) ;   1973 extern  __attribute__((__nothrow__)) void setlinebuf(FILE *__stream ) ;
1974 extern int fprintf(FILE * __restrict  __stream ,   1974 extern int fprintf(FILE * __restrict  __stream ,
1975                    char const   * __restrict  __format  , ...) ;   1975                    char const   * __restrict  __format  , ...) ;
1976 extern int printf(char const   * __restrict  __format  , ...) ;   1976 extern int printf(char const   * __restrict  __format  , ...) ;
1977 extern  __attribute__((__nothrow__)) int sprintf(char * __restrict  __s ,   1977 extern  __attribute__((__nothrow__)) int sprintf(char * __restrict  __s ,
1978                                                  char const   * __restrict  __format   1978                                                  char const   * __restrict  __format
1979                                                  , ...) ;   1979                                                  , ...) ;
1980 extern int vfprintf(FILE * __restrict  __s ,   1980 extern int vfprintf(FILE * __restrict  __s ,
1981                     char const   * __restrict  __format , __gnuc_va_list __arg ) ;   1981                     char const   * __restrict  __format , __gnuc_va_list __arg ) ;
1982 __inline extern int vprintf(char const   * __restrict  __fmt ,   1982 __inline extern int vprintf(char const   * __restrict  __fmt ,
1983                             __gnuc_va_list __arg ) ;   1983                             __gnuc_va_list __arg ) ;
1984 extern  __attribute__((__nothrow__)) int vsprintf(char * __restrict  __s ,   1984 extern  __attribute__((__nothrow__)) int vsprintf(char * __restrict  __s ,
1985                                                   char const   * __restrict  __format ,   1985                                                   char const   * __restrict  __format ,
1986                                                   __gnuc_va_list __arg ) ;   1986                                                   __gnuc_va_list __arg ) ;
1987 extern  __attribute__((__nothrow__)) int ( /* format attribute */  snprintf)(char * __restrict  __s ,   1987 extern  __attribute__((__nothrow__)) int ( /* format attribute */  snprintf)(char * __restrict  __s ,
1988                                                                              size_t __maxlen ,   1988                                                                              size_t __maxlen ,
1989                                                                              char const   * __restrict  __format   1989                                                                              char const   * __restrict  __format
1990                                                                              , ...) ;   1990                                                                              , ...) ;
1991 extern  __attribute__((__nothrow__)) int ( /* format attribute */  vsnprintf)(char * __restrict  __s ,   1991 extern  __attribute__((__nothrow__)) int ( /* format attribute */  vsnprintf)(char * __restrict  __s ,
1992                                                                               size_t __maxlen ,   1992                                                                               size_t __maxlen ,
1993                                                                               char const   * __restrict  __format ,   1993                                                                               char const   * __restrict  __format ,
1994                                                                               __gnuc_va_list __arg ) ;   1994                                                                               __gnuc_va_list __arg ) ;
1995 extern int ( /* format attribute */  vdprintf)(int __fd ,   1995 extern int ( /* format attribute */  vdprintf)(int __fd ,
1996                                                char const   * __restrict  __fmt ,   1996                                                char const   * __restrict  __fmt ,
1997                                                __gnuc_va_list __arg ) ;   1997                                                __gnuc_va_list __arg ) ;
1998 extern int ( /* format attribute */  dprintf)(int __fd ,   1998 extern int ( /* format attribute */  dprintf)(int __fd ,
1999                                               char const   * __restrict  __fmt   1999                                               char const   * __restrict  __fmt
2000                                               , ...) ;   2000                                               , ...) ;
2001 extern int fscanf(FILE * __restrict  __stream ,   2001 extern int fscanf(FILE * __restrict  __stream ,
2002                   char const   * __restrict  __format  , ...)  __asm__("__isoc99_fscanf")  ;   2002                   char const   * __restrict  __format  , ...)  __asm__("__isoc99_fscanf")  ;
2003 extern int scanf(char const   * __restrict  __format  , ...)  __asm__("__isoc99_scanf")  ;   2003 extern int scanf(char const   * __restrict  __format  , ...)  __asm__("__isoc99_scanf")  ;
2004 extern  __attribute__((__nothrow__)) int sscanf(char const   * __restrict  __s ,   2004 extern  __attribute__((__nothrow__)) int sscanf(char const   * __restrict  __s ,
2005                                                 char const   * __restrict  __format   2005                                                 char const   * __restrict  __format
2006                                                 , ...)  __asm__("__isoc99_sscanf")  ;   2006                                                 , ...)  __asm__("__isoc99_sscanf")  ;
2007 extern int ( /* format attribute */  vfscanf)(FILE * __restrict  __s ,   2007 extern int ( /* format attribute */  vfscanf)(FILE * __restrict  __s ,
2008                                               char const   * __restrict  __format ,   2008                                               char const   * __restrict  __format ,
2009                                               __gnuc_va_list __arg )  __asm__("__isoc99_vfscanf")  ;   2009                                               __gnuc_va_list __arg )  __asm__("__isoc99_vfscanf")  ;
2010 extern int ( /* format attribute */  vscanf)(char const   * __restrict  __format ,   2010 extern int ( /* format attribute */  vscanf)(char const   * __restrict  __format ,
2011                                              __gnuc_va_list __arg )  __asm__("__isoc99_vscanf")  ;   2011                                              __gnuc_va_list __arg )  __asm__("__isoc99_vscanf")  ;
2012 extern  __attribute__((__nothrow__)) int ( /* format attribute */  vsscanf)(char const   * __restrict  __s ,   2012 extern  __attribute__((__nothrow__)) int ( /* format attribute */  vsscanf)(char const   * __restrict  __s ,
2013                                                                             char const   * __restrict  __format ,   2013                                                                             char const   * __restrict  __format ,
2014                                                                             __gnuc_va_list __arg )  __asm__("__isoc99_vsscanf")  ;   2014                                                                             __gnuc_va_list __arg )  __asm__("__isoc99_vsscanf")  ;
2015 extern int fgetc(FILE *__stream ) ;   2015 extern int fgetc(FILE *__stream ) ;
2016 extern int getc(FILE *__stream ) ;   2016 extern int getc(FILE *__stream ) ;
2017 __inline extern int getchar(void) ;   2017 __inline extern int getchar(void) ;
2018 __inline extern int getc_unlocked(FILE *__fp ) ;   2018 __inline extern int getc_unlocked(FILE *__fp ) ;
2019 __inline extern int getchar_unlocked(void) ;   2019 __inline extern int getchar_unlocked(void) ;
2020 __inline extern int fgetc_unlocked(FILE *__fp ) ;   2020 __inline extern int fgetc_unlocked(FILE *__fp ) ;
2021 extern int fputc(int __c , FILE *__stream ) ;   2021 extern int fputc(int __c , FILE *__stream ) ;
2022 extern int putc(int __c , FILE *__stream ) ;   2022 extern int putc(int __c , FILE *__stream ) ;
2023 __inline extern int putchar(int __c ) ;   2023 __inline extern int putchar(int __c ) ;
2024 __inline extern int fputc_unlocked(int __c , FILE *__stream ) ;   2024 __inline extern int fputc_unlocked(int __c , FILE *__stream ) ;
2025 __inline extern int putc_unlocked(int __c , FILE *__stream ) ;   2025 __inline extern int putc_unlocked(int __c , FILE *__stream ) ;
2026 __inline extern int putchar_unlocked(int __c ) ;   2026 __inline extern int putchar_unlocked(int __c ) ;
2027 extern int getw(FILE *__stream ) ;   2027 extern int getw(FILE *__stream ) ;
2028 extern int putw(int __w , FILE *__stream ) ;   2028 extern int putw(int __w , FILE *__stream ) ;
2029 extern char *fgets(char * __restrict  __s , int __n ,   2029 extern char *fgets(char * __restrict  __s , int __n ,
2030                    FILE * __restrict  __stream ) ;   2030                    FILE * __restrict  __stream ) ;
2031 extern char *gets(char *__s ) ;   2031 extern char *gets(char *__s ) ;
2032 extern __ssize_t __getdelim(char ** __restrict  __lineptr ,   2032 extern __ssize_t __getdelim(char ** __restrict  __lineptr ,
2033                             size_t * __restrict  __n , int __delimiter ,   2033                             size_t * __restrict  __n , int __delimiter ,
2034                             FILE * __restrict  __stream ) ;   2034                             FILE * __restrict  __stream ) ;
2035 extern __ssize_t getdelim(char ** __restrict  __lineptr ,   2035 extern __ssize_t getdelim(char ** __restrict  __lineptr ,
2036                           size_t * __restrict  __n , int __delimiter ,   2036                           size_t * __restrict  __n , int __delimiter ,
2037                           FILE * __restrict  __stream ) ;   2037                           FILE * __restrict  __stream ) ;
2038 extern __ssize_t getline(char ** __restrict  __lineptr ,   2038 extern __ssize_t getline(char ** __restrict  __lineptr ,
2039                          size_t * __restrict  __n , FILE * __restrict  __stream ) ;   2039                          size_t * __restrict  __n , FILE * __restrict  __stream ) ;
2040 extern int fputs(char const   * __restrict  __s , FILE * __restrict  __stream ) ;   2040 extern int fputs(char const   * __restrict  __s , FILE * __restrict  __stream ) ;
2041 extern int puts(char const   *__s ) ;   2041 extern int puts(char const   *__s ) ;
2042 extern int ungetc(int __c , FILE *__stream ) ;   2042 extern int ungetc(int __c , FILE *__stream ) ;
2043 extern size_t fread(void * __restrict  __ptr , size_t __size , size_t __n ,   2043 extern size_t fread(void * __restrict  __ptr , size_t __size , size_t __n ,
2044                     FILE * __restrict  __stream ) ;   2044                     FILE * __restrict  __stream ) ;
2045 extern size_t fwrite(void const   * __restrict  __ptr , size_t __size ,   2045 extern size_t fwrite(void const   * __restrict  __ptr , size_t __size ,
2046                      size_t __n , FILE * __restrict  __s ) ;   2046                      size_t __n , FILE * __restrict  __s ) ;
2047 extern size_t fread_unlocked(void * __restrict  __ptr , size_t __size ,   2047 extern size_t fread_unlocked(void * __restrict  __ptr , size_t __size ,
2048                              size_t __n , FILE * __restrict  __stream ) ;   2048                              size_t __n , FILE * __restrict  __stream ) ;
2049 extern size_t fwrite_unlocked(void const   * __restrict  __ptr , size_t __size ,   2049 extern size_t fwrite_unlocked(void const   * __restrict  __ptr , size_t __size ,
2050                               size_t __n , FILE * __restrict  __stream ) ;   2050                               size_t __n , FILE * __restrict  __stream ) ;
2051 extern int fseek(FILE *__stream , long __off , int __whence ) ;   2051 extern int fseek(FILE *__stream , long __off , int __whence ) ;
2052 extern long ftell(FILE *__stream ) ;   2052 extern long ftell(FILE *__stream ) ;
2053 extern void rewind(FILE *__stream ) ;   2053 extern void rewind(FILE *__stream ) ;
2054 extern int fseeko(FILE *__stream , __off64_t __off , int __whence )  __asm__("fseeko64")  ;   2054 extern int fseeko(FILE *__stream , __off64_t __off , int __whence )  __asm__("fseeko64")  ;
2055 extern __off64_t ftello(FILE *__stream )  __asm__("ftello64")  ;   2055 extern __off64_t ftello(FILE *__stream )  __asm__("ftello64")  ;
2056 extern int fgetpos(FILE * __restrict  __stream , fpos_t * __restrict  __pos )  __asm__("fgetpos64")  ;   2056 extern int fgetpos(FILE * __restrict  __stream , fpos_t * __restrict  __pos )  __asm__("fgetpos64")  ;
2057 extern int fsetpos(FILE *__stream , fpos_t const   *__pos )  __asm__("fsetpos64")  ;   2057 extern int fsetpos(FILE *__stream , fpos_t const   *__pos )  __asm__("fsetpos64")  ;
2058 extern  __attribute__((__nothrow__)) void clearerr(FILE *__stream ) ;   2058 extern  __attribute__((__nothrow__)) void clearerr(FILE *__stream ) ;
2059 extern  __attribute__((__nothrow__)) int feof(FILE *__stream ) ;   2059 extern  __attribute__((__nothrow__)) int feof(FILE *__stream ) ;
2060 extern  __attribute__((__nothrow__)) int ferror(FILE *__stream ) ;   2060 extern  __attribute__((__nothrow__)) int ferror(FILE *__stream ) ;
2061 extern  __attribute__((__nothrow__)) void clearerr_unlocked(FILE *__stream ) ;   2061 extern  __attribute__((__nothrow__)) void clearerr_unlocked(FILE *__stream ) ;
2062 __inline extern  __attribute__((__nothrow__)) int feof_unlocked(FILE *__stream ) ;   2062 __inline extern  __attribute__((__nothrow__)) int feof_unlocked(FILE *__stream ) ;
2063 __inline extern  __attribute__((__nothrow__)) int ferror_unlocked(FILE *__stream ) ;   2063 __inline extern  __attribute__((__nothrow__)) int ferror_unlocked(FILE *__stream ) ;
2064 extern void perror(char const   *__s ) ;   2064 extern void perror(char const   *__s ) ;
2065 extern int sys_nerr ;   2065 extern int sys_nerr ;
2066 extern char const   * const  sys_errlist[] ;   2066 extern char const   * const  sys_errlist[] ;
2067 extern  __attribute__((__nothrow__)) int fileno(FILE *__stream ) ;   2067 extern  __attribute__((__nothrow__)) int fileno(FILE *__stream ) ;
2068 extern  __attribute__((__nothrow__)) int fileno_unlocked(FILE *__stream ) ;   2068 extern  __attribute__((__nothrow__)) int fileno_unlocked(FILE *__stream ) ;
2069 extern FILE *popen(char const   *__command , char const   *__modes ) ;   2069 extern FILE *popen(char const   *__command , char const   *__modes ) ;
2070 extern int pclose(FILE *__stream ) ;   2070 extern int pclose(FILE *__stream ) ;
2071 extern  __attribute__((__nothrow__)) char *ctermid(char *__s ) ;   2071 extern  __attribute__((__nothrow__)) char *ctermid(char *__s ) ;
2072 extern  __attribute__((__nothrow__)) void flockfile(FILE *__stream ) ;   2072 extern  __attribute__((__nothrow__)) void flockfile(FILE *__stream ) ;
2073 extern  __attribute__((__nothrow__)) int ftrylockfile(FILE *__stream ) ;   2073 extern  __attribute__((__nothrow__)) int ftrylockfile(FILE *__stream ) ;
2074 extern  __attribute__((__nothrow__)) void funlockfile(FILE *__stream ) ;   2074 extern  __attribute__((__nothrow__)) void funlockfile(FILE *__stream ) ;
2075 __inline extern int vprintf(char const   * __restrict  __fmt ,   2075 __inline extern int vprintf(char const   * __restrict  __fmt ,
2076                             __gnuc_va_list __arg )   2076                             __gnuc_va_list __arg )
2077 {   2077 {
2078   int tmp ;   2078   int tmp ;
2079     2079  
2080   {   2080   {
2081   tmp = vfprintf((FILE */* __restrict  */)stdout, __fmt, __arg);   2081   tmp = vfprintf((FILE */* __restrict  */)stdout, __fmt, __arg);
2082   return (tmp);   2082   return (tmp);
2083 }   2083 }
2084 }   2084 }
2085 __inline extern int getchar(void)   2085 __inline extern int getchar(void)
2086 {   2086 {
2087   int tmp ;   2087   int tmp ;
2088     2088  
2089   {   2089   {
2090   tmp = _IO_getc(stdin);   2090   tmp = _IO_getc(stdin);
2091   return (tmp);   2091   return (tmp);
2092 }   2092 }
2093 }   2093 }
2094 __inline extern int fgetc_unlocked(FILE *__fp )   2094 __inline extern int fgetc_unlocked(FILE *__fp )
2095 {   2095 {
2096   long tmp ;   2096   long tmp ;
2097   int tmp___0 ;   2097   int tmp___0 ;
2098   char *tmp___1 ;   2098   char *tmp___1 ;
2099   int tmp___2 ;   2099   int tmp___2 ;
2100   long tmp___3 ;   2100   long tmp___3 ;
2101     2101  
2102   {   2102   {
2103   tmp___3 = __builtin_expect((long )((unsigned int )__fp->_IO_read_ptr >= (unsigned int )__fp->_IO_read_end),   2103   tmp___3 = __builtin_expect((long )((unsigned int )__fp->_IO_read_ptr >= (unsigned int )__fp->_IO_read_end),
2104                              0L);   2104                              0L);
2105   if (tmp___3) {   2105   if (tmp___3) {
2106     tmp___0 = __uflow(__fp);   2106     tmp___0 = __uflow(__fp);
2107     tmp___2 = tmp___0;   2107     tmp___2 = tmp___0;
2108   } else {   2108   } else {
2109     tmp___1 = __fp->_IO_read_ptr;   2109     tmp___1 = __fp->_IO_read_ptr;
2110     (__fp->_IO_read_ptr) ++;   2110     (__fp->_IO_read_ptr) ++;
2111     tmp___2 = (int )*((unsigned char *)tmp___1);   2111     tmp___2 = (int )*((unsigned char *)tmp___1);
2112   }   2112   }
2113   return (tmp___2);   2113   return (tmp___2);
2114 }   2114 }
2115 }   2115 }
2116 __inline extern int getc_unlocked(FILE *__fp )   2116 __inline extern int getc_unlocked(FILE *__fp )
2117 {   2117 {
2118   long tmp ;   2118   long tmp ;
2119   int tmp___0 ;   2119   int tmp___0 ;
2120   char *tmp___1 ;   2120   char *tmp___1 ;
2121   int tmp___2 ;   2121   int tmp___2 ;
2122   long tmp___3 ;   2122   long tmp___3 ;
2123     2123  
2124   {   2124   {
2125   tmp___3 = __builtin_expect((long )((unsigned int )__fp->_IO_read_ptr >= (unsigned int )__fp->_IO_read_end),   2125   tmp___3 = __builtin_expect((long )((unsigned int )__fp->_IO_read_ptr >= (unsigned int )__fp->_IO_read_end),
2126                              0L);   2126                              0L);
2127   if (tmp___3) {   2127   if (tmp___3) {
2128     tmp___0 = __uflow(__fp);   2128     tmp___0 = __uflow(__fp);
2129     tmp___2 = tmp___0;   2129     tmp___2 = tmp___0;
2130   } else {   2130   } else {
2131     tmp___1 = __fp->_IO_read_ptr;   2131     tmp___1 = __fp->_IO_read_ptr;
2132     (__fp->_IO_read_ptr) ++;   2132     (__fp->_IO_read_ptr) ++;
2133     tmp___2 = (int )*((unsigned char *)tmp___1);   2133     tmp___2 = (int )*((unsigned char *)tmp___1);
2134   }   2134   }
2135   return (tmp___2);   2135   return (tmp___2);
2136 }   2136 }
2137 }   2137 }
2138 __inline extern int getchar_unlocked(void)   2138 __inline extern int getchar_unlocked(void)
2139 {   2139 {
2140   long tmp ;   2140   long tmp ;
2141   int tmp___0 ;   2141   int tmp___0 ;
2142   char *tmp___1 ;   2142   char *tmp___1 ;
2143   int tmp___2 ;   2143   int tmp___2 ;
2144   long tmp___3 ;   2144   long tmp___3 ;
2145     2145  
2146   {   2146   {
2147   tmp___3 = __builtin_expect((long )((unsigned int )stdin->_IO_read_ptr >= (unsigned int )stdin->_IO_read_end),   2147   tmp___3 = __builtin_expect((long )((unsigned int )stdin->_IO_read_ptr >= (unsigned int )stdin->_IO_read_end),
2148                              0L);   2148                              0L);
2149   if (tmp___3) {   2149   if (tmp___3) {
2150     tmp___0 = __uflow(stdin);   2150     tmp___0 = __uflow(stdin);
2151     tmp___2 = tmp___0;   2151     tmp___2 = tmp___0;
2152   } else {   2152   } else {
2153     tmp___1 = stdin->_IO_read_ptr;   2153     tmp___1 = stdin->_IO_read_ptr;
2154     (stdin->_IO_read_ptr) ++;   2154     (stdin->_IO_read_ptr) ++;
2155     tmp___2 = (int )*((unsigned char *)tmp___1);   2155     tmp___2 = (int )*((unsigned char *)tmp___1);
2156   }   2156   }
2157   return (tmp___2);   2157   return (tmp___2);
2158 }   2158 }
2159 }   2159 }
2160 __inline extern int putchar(int __c )   2160 __inline extern int putchar(int __c )
2161 {   2161 {
2162   int tmp ;   2162   int tmp ;
2163     2163  
2164   {   2164   {
2165   tmp = _IO_putc(__c, stdout);   2165   tmp = _IO_putc(__c, stdout);
2166   return (tmp);   2166   return (tmp);
2167 }   2167 }
2168 }   2168 }
2169 __inline extern int fputc_unlocked(int __c , FILE *__stream )   2169 __inline extern int fputc_unlocked(int __c , FILE *__stream )
2170 {   2170 {
2171   long tmp ;   2171   long tmp ;
2172   int tmp___0 ;   2172   int tmp___0 ;
2173   char *tmp___1 ;   2173   char *tmp___1 ;
2174   char tmp___2 ;   2174   char tmp___2 ;
2175   int tmp___3 ;   2175   int tmp___3 ;
2176   long tmp___4 ;   2176   long tmp___4 ;
2177     2177  
2178   {   2178   {
2179   tmp___4 = __builtin_expect((long )((unsigned int )__stream->_IO_write_ptr >= (unsigned int )__stream->_IO_write_end),   2179   tmp___4 = __builtin_expect((long )((unsigned int )__stream->_IO_write_ptr >= (unsigned int )__stream->_IO_write_end),
2180                              0L);   2180                              0L);
2181   if (tmp___4) {   2181   if (tmp___4) {
2182     tmp___0 = __overflow(__stream, (int )((unsigned char )__c));   2182     tmp___0 = __overflow(__stream, (int )((unsigned char )__c));
2183     tmp___3 = tmp___0;   2183     tmp___3 = tmp___0;
2184   } else {   2184   } else {
2185     tmp___1 = __stream->_IO_write_ptr;   2185     tmp___1 = __stream->_IO_write_ptr;
2186     (__stream->_IO_write_ptr) ++;   2186     (__stream->_IO_write_ptr) ++;
2187     tmp___2 = (char )__c;   2187     tmp___2 = (char )__c;
2188     *tmp___1 = tmp___2;   2188     *tmp___1 = tmp___2;
2189     tmp___3 = (int )((unsigned char )tmp___2);   2189     tmp___3 = (int )((unsigned char )tmp___2);
2190   }   2190   }
2191   return (tmp___3);   2191   return (tmp___3);
2192 }   2192 }
2193 }   2193 }
2194 __inline extern int putc_unlocked(int __c , FILE *__stream )   2194 __inline extern int putc_unlocked(int __c , FILE *__stream )
2195 {   2195 {
2196   long tmp ;   2196   long tmp ;
2197   int tmp___0 ;   2197   int tmp___0 ;
2198   char *tmp___1 ;   2198   char *tmp___1 ;
2199   char tmp___2 ;   2199   char tmp___2 ;
2200   int tmp___3 ;   2200   int tmp___3 ;
2201   long tmp___4 ;   2201   long tmp___4 ;
2202     2202  
2203   {   2203   {
2204   tmp___4 = __builtin_expect((long )((unsigned int )__stream->_IO_write_ptr >= (unsigned int )__stream->_IO_write_end),   2204   tmp___4 = __builtin_expect((long )((unsigned int )__stream->_IO_write_ptr >= (unsigned int )__stream->_IO_write_end),
2205                              0L);   2205                              0L);
2206   if (tmp___4) {   2206   if (tmp___4) {
2207     tmp___0 = __overflow(__stream, (int )((unsigned char )__c));   2207     tmp___0 = __overflow(__stream, (int )((unsigned char )__c));
2208     tmp___3 = tmp___0;   2208     tmp___3 = tmp___0;
2209   } else {   2209   } else {
2210     tmp___1 = __stream->_IO_write_ptr;   2210     tmp___1 = __stream->_IO_write_ptr;
2211     (__stream->_IO_write_ptr) ++;   2211     (__stream->_IO_write_ptr) ++;
2212     tmp___2 = (char )__c;   2212     tmp___2 = (char )__c;
2213     *tmp___1 = tmp___2;   2213     *tmp___1 = tmp___2;
2214     tmp___3 = (int )((unsigned char )tmp___2);   2214     tmp___3 = (int )((unsigned char )tmp___2);
2215   }   2215   }
2216   return (tmp___3);   2216   return (tmp___3);
2217 }   2217 }
2218 }   2218 }
2219 __inline extern int putchar_unlocked(int __c )   2219 __inline extern int putchar_unlocked(int __c )
2220 {   2220 {
2221   long tmp ;   2221   long tmp ;
2222   int tmp___0 ;   2222   int tmp___0 ;
2223   char *tmp___1 ;   2223   char *tmp___1 ;
2224   char tmp___2 ;   2224   char tmp___2 ;
2225   int tmp___3 ;   2225   int tmp___3 ;
2226   long tmp___4 ;   2226   long tmp___4 ;
2227     2227  
2228   {   2228   {
2229   tmp___4 = __builtin_expect((long )((unsigned int )stdout->_IO_write_ptr >= (unsigned int )stdout->_IO_write_end),   2229   tmp___4 = __builtin_expect((long )((unsigned int )stdout->_IO_write_ptr >= (unsigned int )stdout->_IO_write_end),
2230                              0L);   2230                              0L);
2231   if (tmp___4) {   2231   if (tmp___4) {
2232     tmp___0 = __overflow(stdout, (int )((unsigned char )__c));   2232     tmp___0 = __overflow(stdout, (int )((unsigned char )__c));
2233     tmp___3 = tmp___0;   2233     tmp___3 = tmp___0;
2234   } else {   2234   } else {
2235     tmp___1 = stdout->_IO_write_ptr;   2235     tmp___1 = stdout->_IO_write_ptr;
2236     (stdout->_IO_write_ptr) ++;   2236     (stdout->_IO_write_ptr) ++;
2237     tmp___2 = (char )__c;   2237     tmp___2 = (char )__c;
2238     *tmp___1 = tmp___2;   2238     *tmp___1 = tmp___2;
2239     tmp___3 = (int )((unsigned char )tmp___2);   2239     tmp___3 = (int )((unsigned char )tmp___2);
2240   }   2240   }
2241   return (tmp___3);   2241   return (tmp___3);
2242 }   2242 }
2243 }   2243 }
2244 __inline extern  __attribute__((__nothrow__)) int feof_unlocked(FILE *__stream ) ;   2244 __inline extern  __attribute__((__nothrow__)) int feof_unlocked(FILE *__stream ) ;
2245 __inline extern int feof_unlocked(FILE *__stream )   2245 __inline extern int feof_unlocked(FILE *__stream )
2246 {   2246 {
2247     2247  
2248     2248  
2249   {   2249   {
2250   return ((__stream->_flags & 16) != 0);   2250   return ((__stream->_flags & 16) != 0);
2251 }   2251 }
2252 }   2252 }
2253 __inline extern  __attribute__((__nothrow__)) int ferror_unlocked(FILE *__stream ) ;   2253 __inline extern  __attribute__((__nothrow__)) int ferror_unlocked(FILE *__stream ) ;
2254 __inline extern int ferror_unlocked(FILE *__stream )   2254 __inline extern int ferror_unlocked(FILE *__stream )
2255 {   2255 {
2256     2256  
2257     2257  
2258   {   2258   {
2259   return ((__stream->_flags & 32) != 0);   2259   return ((__stream->_flags & 32) != 0);
2260 }   2260 }
2261 }   2261 }
2262 extern char const   *TIFFGetVersion(void) ;   2262 extern char const   *TIFFGetVersion(void) ;
2263 extern TIFFCodec const   *TIFFFindCODEC(uint16  ) ;   2263 extern TIFFCodec const   *TIFFFindCODEC(uint16  ) ;
2264 extern TIFFCodec *TIFFRegisterCODEC(uint16  , char const   * ,   2264 extern TIFFCodec *TIFFRegisterCODEC(uint16  , char const   * ,
2265                                     int (*)(TIFF * , int  ) ) ;   2265                                     int (*)(TIFF * , int  ) ) ;
2266 extern void TIFFUnRegisterCODEC(TIFFCodec * ) ;   2266 extern void TIFFUnRegisterCODEC(TIFFCodec * ) ;
2267 extern int TIFFIsCODECConfigured(uint16  ) ;   2267 extern int TIFFIsCODECConfigured(uint16  ) ;
2268 extern TIFFCodec *TIFFGetConfiguredCODECs(void) ;   2268 extern TIFFCodec *TIFFGetConfiguredCODECs(void) ;
2269 extern void *_TIFFmalloc(tmsize_t s ) ;   2269 extern void *_TIFFmalloc(tmsize_t s ) ;
2270 extern void *_TIFFrealloc(void *p , tmsize_t s ) ;   2270 extern void *_TIFFrealloc(void *p , tmsize_t s ) ;
2271 extern void _TIFFmemset(void *p , int v , tmsize_t c ) ;   2271 extern void _TIFFmemset(void *p , int v , tmsize_t c ) ;
2272 extern void _TIFFmemcpy(void *d , void const   *s , tmsize_t c ) ;   2272 extern void _TIFFmemcpy(void *d , void const   *s , tmsize_t c ) ;
2273 extern int _TIFFmemcmp(void const   *p1 , void const   *p2 , tmsize_t c ) ;   2273 extern int _TIFFmemcmp(void const   *p1 , void const   *p2 , tmsize_t c ) ;
2274 extern void _TIFFfree(void *p ) ;   2274 extern void _TIFFfree(void *p ) ;
2275 extern int TIFFGetTagListCount(TIFF * ) ;   2275 extern int TIFFGetTagListCount(TIFF * ) ;
2276 extern uint32 TIFFGetTagListEntry(TIFF * , int tag_index ) ;   2276 extern uint32 TIFFGetTagListEntry(TIFF * , int tag_index ) ;
2277 extern TIFFField const   *TIFFFindField(TIFF * , uint32  , TIFFDataType  ) ;   2277 extern TIFFField const   *TIFFFindField(TIFF * , uint32  , TIFFDataType  ) ;
2278 extern TIFFField const   *TIFFFieldWithTag(TIFF * , uint32  ) ;   2278 extern TIFFField const   *TIFFFieldWithTag(TIFF * , uint32  ) ;
2279 extern TIFFField const   *TIFFFieldWithName(TIFF * , char const   * ) ;   2279 extern TIFFField const   *TIFFFieldWithName(TIFF * , char const   * ) ;
2280 extern TIFFTagMethods *TIFFAccessTagMethods(TIFF * ) ;   2280 extern TIFFTagMethods *TIFFAccessTagMethods(TIFF * ) ;
2281 extern void *TIFFGetClientInfo(TIFF * , char const   * ) ;   2281 extern void *TIFFGetClientInfo(TIFF * , char const   * ) ;
2282 extern void TIFFSetClientInfo(TIFF * , void * , char const   * ) ;   2282 extern void TIFFSetClientInfo(TIFF * , void * , char const   * ) ;
2283 extern void TIFFCleanup(TIFF *tif ) ;   2283 extern void TIFFCleanup(TIFF *tif ) ;
2284 extern void TIFFClose(TIFF *tif ) ;   2284 extern void TIFFClose(TIFF *tif ) ;
2285 extern int TIFFFlush(TIFF *tif ) ;   2285 extern int TIFFFlush(TIFF *tif ) ;
2286 extern int TIFFFlushData(TIFF *tif ) ;   2286 extern int TIFFFlushData(TIFF *tif ) ;
2287 extern int TIFFGetField(TIFF *tif , uint32 tag  , ...) ;   2287 extern int TIFFGetField(TIFF *tif , uint32 tag  , ...) ;
2288 extern int TIFFVGetField(TIFF *tif , uint32 tag , va_list ap ) ;   2288 extern int TIFFVGetField(TIFF *tif , uint32 tag , va_list ap ) ;
2289 extern int TIFFGetFieldDefaulted(TIFF *tif , uint32 tag  , ...) ;   2289 extern int TIFFGetFieldDefaulted(TIFF *tif , uint32 tag  , ...) ;
2290 extern int TIFFVGetFieldDefaulted(TIFF *tif , uint32 tag , va_list ap ) ;   2290 extern int TIFFVGetFieldDefaulted(TIFF *tif , uint32 tag , va_list ap ) ;
2291 extern int TIFFReadDirectory(TIFF *tif ) ;   2291 extern int TIFFReadDirectory(TIFF *tif ) ;
2292 extern int TIFFReadCustomDirectory(TIFF *tif , toff_t diroff ,   2292 extern int TIFFReadCustomDirectory(TIFF *tif , toff_t diroff ,
2293                                    TIFFFieldArray const   *infoarray ) ;   2293                                    TIFFFieldArray const   *infoarray ) ;
2294 extern int TIFFReadEXIFDirectory(TIFF *tif , toff_t diroff ) ;   2294 extern int TIFFReadEXIFDirectory(TIFF *tif , toff_t diroff ) ;
2295 extern uint64 TIFFScanlineSize64(TIFF *tif ) ;   2295 extern uint64 TIFFScanlineSize64(TIFF *tif ) ;
2296 extern tmsize_t TIFFScanlineSize(TIFF *tif ) ;   2296 extern tmsize_t TIFFScanlineSize(TIFF *tif ) ;
2297 extern uint64 TIFFRasterScanlineSize64(TIFF *tif ) ;   2297 extern uint64 TIFFRasterScanlineSize64(TIFF *tif ) ;
2298 extern tmsize_t TIFFRasterScanlineSize(TIFF *tif ) ;   2298 extern tmsize_t TIFFRasterScanlineSize(TIFF *tif ) ;
2299 extern uint64 TIFFStripSize64(TIFF *tif ) ;   2299 extern uint64 TIFFStripSize64(TIFF *tif ) ;
2300 extern tmsize_t TIFFStripSize(TIFF *tif ) ;   2300 extern tmsize_t TIFFStripSize(TIFF *tif ) ;
2301 extern uint64 TIFFRawStripSize64(TIFF *tif , uint32 strip ) ;   2301 extern uint64 TIFFRawStripSize64(TIFF *tif , uint32 strip ) ;
2302 extern tmsize_t TIFFRawStripSize(TIFF *tif , uint32 strip ) ;   2302 extern tmsize_t TIFFRawStripSize(TIFF *tif , uint32 strip ) ;
2303 extern uint64 TIFFVStripSize64(TIFF *tif , uint32 nrows ) ;   2303 extern uint64 TIFFVStripSize64(TIFF *tif , uint32 nrows ) ;
2304 extern tmsize_t TIFFVStripSize(TIFF *tif , uint32 nrows ) ;   2304 extern tmsize_t TIFFVStripSize(TIFF *tif , uint32 nrows ) ;
2305 extern uint64 TIFFTileRowSize64(TIFF *tif ) ;   2305 extern uint64 TIFFTileRowSize64(TIFF *tif ) ;
2306 extern tmsize_t TIFFTileRowSize(TIFF *tif ) ;   2306 extern tmsize_t TIFFTileRowSize(TIFF *tif ) ;
2307 extern uint64 TIFFTileSize64(TIFF *tif ) ;   2307 extern uint64 TIFFTileSize64(TIFF *tif ) ;
2308 extern tmsize_t TIFFTileSize(TIFF *tif ) ;   2308 extern tmsize_t TIFFTileSize(TIFF *tif ) ;
2309 extern uint64 TIFFVTileSize64(TIFF *tif , uint32 nrows ) ;   2309 extern uint64 TIFFVTileSize64(TIFF *tif , uint32 nrows ) ;
2310 extern tmsize_t TIFFVTileSize(TIFF *tif , uint32 nrows ) ;   2310 extern tmsize_t TIFFVTileSize(TIFF *tif , uint32 nrows ) ;
2311 extern uint32 TIFFDefaultStripSize(TIFF *tif , uint32 request ) ;   2311 extern uint32 TIFFDefaultStripSize(TIFF *tif , uint32 request ) ;
2312 extern void TIFFDefaultTileSize(TIFF * , uint32 * , uint32 * ) ;   2312 extern void TIFFDefaultTileSize(TIFF * , uint32 * , uint32 * ) ;
2313 extern int TIFFFileno(TIFF * ) ;   2313 extern int TIFFFileno(TIFF * ) ;
2314 extern int TIFFSetFileno(TIFF * , int  ) ;   2314 extern int TIFFSetFileno(TIFF * , int  ) ;
2315 extern thandle_t TIFFClientdata(TIFF * ) ;   2315 extern thandle_t TIFFClientdata(TIFF * ) ;
2316 extern thandle_t TIFFSetClientdata(TIFF * , thandle_t  ) ;   2316 extern thandle_t TIFFSetClientdata(TIFF * , thandle_t  ) ;
2317 extern int TIFFGetMode(TIFF * ) ;   2317 extern int TIFFGetMode(TIFF * ) ;
2318 extern int TIFFSetMode(TIFF * , int  ) ;   2318 extern int TIFFSetMode(TIFF * , int  ) ;
2319 extern int TIFFIsTiled(TIFF * ) ;   2319 extern int TIFFIsTiled(TIFF * ) ;
2320 extern int TIFFIsByteSwapped(TIFF * ) ;   2320 extern int TIFFIsByteSwapped(TIFF * ) ;
2321 extern int TIFFIsUpSampled(TIFF * ) ;   2321 extern int TIFFIsUpSampled(TIFF * ) ;
2322 extern int TIFFIsMSB2LSB(TIFF * ) ;   2322 extern int TIFFIsMSB2LSB(TIFF * ) ;
2323 extern int TIFFIsBigEndian(TIFF * ) ;   2323 extern int TIFFIsBigEndian(TIFF * ) ;
2324 extern TIFFReadWriteProc TIFFGetReadProc(TIFF * ) ;   2324 extern TIFFReadWriteProc TIFFGetReadProc(TIFF * ) ;
2325 extern TIFFReadWriteProc TIFFGetWriteProc(TIFF * ) ;   2325 extern TIFFReadWriteProc TIFFGetWriteProc(TIFF * ) ;
2326 extern TIFFSeekProc TIFFGetSeekProc(TIFF * ) ;   2326 extern TIFFSeekProc TIFFGetSeekProc(TIFF * ) ;
2327 extern TIFFCloseProc TIFFGetCloseProc(TIFF * ) ;   2327 extern TIFFCloseProc TIFFGetCloseProc(TIFF * ) ;
2328 extern TIFFSizeProc TIFFGetSizeProc(TIFF * ) ;   2328 extern TIFFSizeProc TIFFGetSizeProc(TIFF * ) ;
2329 extern TIFFMapFileProc TIFFGetMapFileProc(TIFF * ) ;   2329 extern TIFFMapFileProc TIFFGetMapFileProc(TIFF * ) ;
2330 extern TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF * ) ;   2330 extern TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF * ) ;
2331 extern uint32 TIFFCurrentRow(TIFF * ) ;   2331 extern uint32 TIFFCurrentRow(TIFF * ) ;
2332 extern uint16 TIFFCurrentDirectory(TIFF * ) ;   2332 extern uint16 TIFFCurrentDirectory(TIFF * ) ;
2333 extern uint16 TIFFNumberOfDirectories(TIFF * ) ;   2333 extern uint16 TIFFNumberOfDirectories(TIFF * ) ;
2334 extern uint64 TIFFCurrentDirOffset(TIFF * ) ;   2334 extern uint64 TIFFCurrentDirOffset(TIFF * ) ;
2335 extern uint32 TIFFCurrentStrip(TIFF * ) ;   2335 extern uint32 TIFFCurrentStrip(TIFF * ) ;
2336 extern uint32 TIFFCurrentTile(TIFF *tif ) ;   2336 extern uint32 TIFFCurrentTile(TIFF *tif ) ;
2337 extern int TIFFReadBufferSetup(TIFF *tif , void *bp , tmsize_t size ) ;   2337 extern int TIFFReadBufferSetup(TIFF *tif , void *bp , tmsize_t size ) ;
2338 extern int TIFFWriteBufferSetup(TIFF *tif , void *bp , tmsize_t size ) ;   2338 extern int TIFFWriteBufferSetup(TIFF *tif , void *bp , tmsize_t size ) ;
2339 extern int TIFFSetupStrips(TIFF * ) ;   2339 extern int TIFFSetupStrips(TIFF * ) ;
2340 extern int TIFFWriteCheck(TIFF * , int  , char const   * ) ;   2340 extern int TIFFWriteCheck(TIFF * , int  , char const   * ) ;
2341 extern void TIFFFreeDirectory(TIFF * ) ;   2341 extern void TIFFFreeDirectory(TIFF * ) ;
2342 extern int TIFFCreateDirectory(TIFF * ) ;   2342 extern int TIFFCreateDirectory(TIFF * ) ;
2343 extern int TIFFLastDirectory(TIFF * ) ;   2343 extern int TIFFLastDirectory(TIFF * ) ;
2344 extern int TIFFSetDirectory(TIFF * , uint16  ) ;   2344 extern int TIFFSetDirectory(TIFF * , uint16  ) ;
2345 extern int TIFFSetSubDirectory(TIFF * , uint64  ) ;   2345 extern int TIFFSetSubDirectory(TIFF * , uint64  ) ;
2346 extern int TIFFUnlinkDirectory(TIFF * , uint16  ) ;   2346 extern int TIFFUnlinkDirectory(TIFF * , uint16  ) ;
2347 extern int TIFFSetField(TIFF * , uint32   , ...) ;   2347 extern int TIFFSetField(TIFF * , uint32   , ...) ;
2348 extern int TIFFVSetField(TIFF * , uint32  , va_list  ) ;   2348 extern int TIFFVSetField(TIFF * , uint32  , va_list  ) ;
2349 extern int TIFFUnsetField(TIFF * , uint32  ) ;   2349 extern int TIFFUnsetField(TIFF * , uint32  ) ;
2350 extern int TIFFWriteDirectory(TIFF * ) ;   2350 extern int TIFFWriteDirectory(TIFF * ) ;
2351 extern int TIFFCheckpointDirectory(TIFF * ) ;   2351 extern int TIFFCheckpointDirectory(TIFF * ) ;
2352 extern int TIFFRewriteDirectory(TIFF * ) ;   2352 extern int TIFFRewriteDirectory(TIFF * ) ;
2353 extern void TIFFPrintDirectory(TIFF * , FILE * , long  ) ;   2353 extern void TIFFPrintDirectory(TIFF * , FILE * , long  ) ;
2354 extern int TIFFReadScanline(TIFF *tif , void *buf , uint32 row , uint16 sample ) ;   2354 extern int TIFFReadScanline(TIFF *tif , void *buf , uint32 row , uint16 sample ) ;
2355 extern int TIFFWriteScanline(TIFF *tif , void *buf , uint32 row , uint16 sample ) ;   2355 extern int TIFFWriteScanline(TIFF *tif , void *buf , uint32 row , uint16 sample ) ;
2356 extern int TIFFReadRGBAImage(TIFF * , uint32  , uint32  , uint32 * , int  ) ;   2356 extern int TIFFReadRGBAImage(TIFF * , uint32  , uint32  , uint32 * , int  ) ;
2357 extern int TIFFReadRGBAImageOriented(TIFF * , uint32  , uint32  , uint32 * ,   2357 extern int TIFFReadRGBAImageOriented(TIFF * , uint32  , uint32  , uint32 * ,
2358                                      int  , int  ) ;   2358                                      int  , int  ) ;
2359 extern int TIFFReadRGBAStrip(TIFF * , uint32  , uint32 * ) ;   2359 extern int TIFFReadRGBAStrip(TIFF * , uint32  , uint32 * ) ;
2360 extern int TIFFReadRGBATile(TIFF * , uint32  , uint32  , uint32 * ) ;   2360 extern int TIFFReadRGBATile(TIFF * , uint32  , uint32  , uint32 * ) ;
2361 extern int TIFFRGBAImageOK(TIFF * , char * ) ;   2361 extern int TIFFRGBAImageOK(TIFF * , char * ) ;
2362 extern int TIFFRGBAImageBegin(TIFFRGBAImage * , TIFF * , int  , char * ) ;   2362 extern int TIFFRGBAImageBegin(TIFFRGBAImage * , TIFF * , int  , char * ) ;
2363 extern int TIFFRGBAImageGet(TIFFRGBAImage * , uint32 * , uint32  , uint32  ) ;   2363 extern int TIFFRGBAImageGet(TIFFRGBAImage * , uint32 * , uint32  , uint32  ) ;
2364 extern void TIFFRGBAImageEnd(TIFFRGBAImage * ) ;   2364 extern void TIFFRGBAImageEnd(TIFFRGBAImage * ) ;
2365 extern TIFF *TIFFOpen(char const   * , char const   * ) ;   2365 extern TIFF *TIFFOpen(char const   * , char const   * ) ;
2366 extern TIFF *TIFFFdOpen(int  , char const   * , char const   * ) ;   2366 extern TIFF *TIFFFdOpen(int  , char const   * , char const   * ) ;
2367 extern TIFF *TIFFClientOpen(char const   * , char const   * , thandle_t  ,   2367 extern TIFF *TIFFClientOpen(char const   * , char const   * , thandle_t  ,
2368                             tmsize_t (*)(thandle_t  , void * , tmsize_t  ) ,   2368                             tmsize_t (*)(thandle_t  , void * , tmsize_t  ) ,
2369                             tmsize_t (*)(thandle_t  , void * , tmsize_t  ) ,   2369                             tmsize_t (*)(thandle_t  , void * , tmsize_t  ) ,
2370                             toff_t (*)(thandle_t  , toff_t  , int  ) ,   2370                             toff_t (*)(thandle_t  , toff_t  , int  ) ,
2371                             int (*)(thandle_t  ) , toff_t (*)(thandle_t  ) ,   2371                             int (*)(thandle_t  ) , toff_t (*)(thandle_t  ) ,
2372                             int (*)(thandle_t  , void **base , toff_t *size ) ,   2372                             int (*)(thandle_t  , void **base , toff_t *size ) ,
2373                             void (*)(thandle_t  , void *base , toff_t size ) ) ;   2373                             void (*)(thandle_t  , void *base , toff_t size ) ) ;
2374 extern char const   *TIFFFileName(TIFF * ) ;   2374 extern char const   *TIFFFileName(TIFF * ) ;
2375 extern char const   *TIFFSetFileName(TIFF * , char const   * ) ;   2375 extern char const   *TIFFSetFileName(TIFF * , char const   * ) ;
2376 extern void ( /* format attribute */  TIFFError)(char const   * ,   2376 extern void ( /* format attribute */  TIFFError)(char const   * ,
2377                                                  char const   *  , ...) ;   2377                                                  char const   *  , ...) ;
2378 extern void ( /* format attribute */  TIFFErrorExt)(thandle_t  ,   2378 extern void ( /* format attribute */  TIFFErrorExt)(thandle_t  ,
2379                                                     char const   * ,   2379                                                     char const   * ,
2380                                                     char const   *  , ...) ;   2380                                                     char const   *  , ...) ;
2381 extern void ( /* format attribute */  TIFFWarning)(char const   * ,   2381 extern void ( /* format attribute */  TIFFWarning)(char const   * ,
2382                                                    char const   *  , ...) ;   2382                                                    char const   *  , ...) ;
2383 extern void ( /* format attribute */  TIFFWarningExt)(thandle_t  ,   2383 extern void ( /* format attribute */  TIFFWarningExt)(thandle_t  ,
2384                                                       char const   * ,   2384                                                       char const   * ,
2385                                                       char const   *  , ...) ;   2385                                                       char const   *  , ...) ;
2386 extern TIFFErrorHandler TIFFSetErrorHandler(void (*)(char const   * ,   2386 extern TIFFErrorHandler TIFFSetErrorHandler(void (*)(char const   * ,
2387                                                      char const   * , va_list  ) ) ;   2387                                                      char const   * , va_list  ) ) ;
2388 extern TIFFErrorHandlerExt TIFFSetErrorHandlerExt(void (*)(thandle_t  ,   2388 extern TIFFErrorHandlerExt TIFFSetErrorHandlerExt(void (*)(thandle_t  ,
2389                                                            char const   * ,   2389                                                            char const   * ,
2390                                                            char const   * ,   2390                                                            char const   * ,
2391                                                            va_list  ) ) ;   2391                                                            va_list  ) ) ;
2392 extern TIFFErrorHandler TIFFSetWarningHandler(void (*)(char const   * ,   2392 extern TIFFErrorHandler TIFFSetWarningHandler(void (*)(char const   * ,
2393                                                        char const   * ,   2393                                                        char const   * ,
2394                                                        va_list  ) ) ;   2394                                                        va_list  ) ) ;
2395 extern TIFFErrorHandlerExt TIFFSetWarningHandlerExt(void (*)(thandle_t  ,   2395 extern TIFFErrorHandlerExt TIFFSetWarningHandlerExt(void (*)(thandle_t  ,
2396                                                              char const   * ,   2396                                                              char const   * ,
2397                                                              char const   * ,   2397                                                              char const   * ,
2398                                                              va_list  ) ) ;   2398                                                              va_list  ) ) ;
2399 extern TIFFExtendProc TIFFSetTagExtender(void (*)(TIFF * ) ) ;   2399 extern TIFFExtendProc TIFFSetTagExtender(void (*)(TIFF * ) ) ;
2400 extern uint32 TIFFComputeTile(TIFF *tif , uint32 x , uint32 y , uint32 z ,   2400 extern uint32 TIFFComputeTile(TIFF *tif , uint32 x , uint32 y , uint32 z ,
2401                               uint16 s ) ;   2401                               uint16 s ) ;
2402 extern int TIFFCheckTile(TIFF *tif , uint32 x , uint32 y , uint32 z , uint16 s ) ;   2402 extern int TIFFCheckTile(TIFF *tif , uint32 x , uint32 y , uint32 z , uint16 s ) ;
2403 extern uint32 TIFFNumberOfTiles(TIFF * ) ;   2403 extern uint32 TIFFNumberOfTiles(TIFF * ) ;
2404 extern tmsize_t TIFFReadTile(TIFF *tif , void *buf , uint32 x , uint32 y ,   2404 extern tmsize_t TIFFReadTile(TIFF *tif , void *buf , uint32 x , uint32 y ,
2405                              uint32 z , uint16 s ) ;   2405                              uint32 z , uint16 s ) ;
2406 extern tmsize_t TIFFWriteTile(TIFF *tif , void *buf , uint32 x , uint32 y ,   2406 extern tmsize_t TIFFWriteTile(TIFF *tif , void *buf , uint32 x , uint32 y ,
2407                               uint32 z , uint16 s ) ;   2407                               uint32 z , uint16 s ) ;
2408 extern uint32 TIFFComputeStrip(TIFF * , uint32  , uint16  ) ;   2408 extern uint32 TIFFComputeStrip(TIFF * , uint32  , uint16  ) ;
2409 extern uint32 TIFFNumberOfStrips(TIFF * ) ;   2409 extern uint32 TIFFNumberOfStrips(TIFF * ) ;
2410 extern tmsize_t TIFFReadEncodedStrip(TIFF *tif , uint32 strip , void *buf ,   2410 extern tmsize_t TIFFReadEncodedStrip(TIFF *tif , uint32 strip , void *buf ,
2411                                      tmsize_t size ) ;   2411                                      tmsize_t size ) ;
2412 extern tmsize_t TIFFReadRawStrip(TIFF *tif , uint32 strip , void *buf ,   2412 extern tmsize_t TIFFReadRawStrip(TIFF *tif , uint32 strip , void *buf ,
2413                                  tmsize_t size ) ;   2413                                  tmsize_t size ) ;
2414 extern tmsize_t TIFFReadEncodedTile(TIFF *tif , uint32 tile , void *buf ,   2414 extern tmsize_t TIFFReadEncodedTile(TIFF *tif , uint32 tile , void *buf ,
2415                                     tmsize_t size ) ;   2415                                     tmsize_t size ) ;
2416 extern tmsize_t TIFFReadRawTile(TIFF *tif , uint32 tile , void *buf ,   2416 extern tmsize_t TIFFReadRawTile(TIFF *tif , uint32 tile , void *buf ,
2417                                 tmsize_t size ) ;   2417                                 tmsize_t size ) ;
2418 extern tmsize_t TIFFWriteEncodedStrip(TIFF *tif , uint32 strip , void *data ,   2418 extern tmsize_t TIFFWriteEncodedStrip(TIFF *tif , uint32 strip , void *data ,
2419                                       tmsize_t cc ) ;   2419                                       tmsize_t cc ) ;
2420 extern tmsize_t TIFFWriteRawStrip(TIFF *tif , uint32 strip , void *data ,   2420 extern tmsize_t TIFFWriteRawStrip(TIFF *tif , uint32 strip , void *data ,
2421                                   tmsize_t cc ) ;   2421                                   tmsize_t cc ) ;
2422 extern tmsize_t TIFFWriteEncodedTile(TIFF *tif , uint32 tile , void *data ,   2422 extern tmsize_t TIFFWriteEncodedTile(TIFF *tif , uint32 tile , void *data ,
2423                                      tmsize_t cc ) ;   2423                                      tmsize_t cc ) ;
2424 extern tmsize_t TIFFWriteRawTile(TIFF *tif , uint32 tile , void *data ,   2424 extern tmsize_t TIFFWriteRawTile(TIFF *tif , uint32 tile , void *data ,
2425                                  tmsize_t cc ) ;   2425                                  tmsize_t cc ) ;
2426 extern int TIFFDataWidth(TIFFDataType  ) ;   2426 extern int TIFFDataWidth(TIFFDataType  ) ;
2427 extern void TIFFSetWriteOffset(TIFF *tif , toff_t off ) ;   2427 extern void TIFFSetWriteOffset(TIFF *tif , toff_t off ) ;
2428 extern void TIFFSwabShort(uint16 * ) ;   2428 extern void TIFFSwabShort(uint16 * ) ;
2429 extern void TIFFSwabLong(uint32 * ) ;   2429 extern void TIFFSwabLong(uint32 * ) ;
2430 extern void TIFFSwabLong8(uint64 * ) ;   2430 extern void TIFFSwabLong8(uint64 * ) ;
2431 extern void TIFFSwabFloat(float * ) ;   2431 extern void TIFFSwabFloat(float * ) ;
2432 extern void TIFFSwabDouble(double * ) ;   2432 extern void TIFFSwabDouble(double * ) ;
2433 extern void TIFFSwabArrayOfShort(uint16 *wp , tmsize_t n ) ;   2433 extern void TIFFSwabArrayOfShort(uint16 *wp , tmsize_t n ) ;
2434 extern void TIFFSwabArrayOfTriples(uint8 *tp , tmsize_t n ) ;   2434 extern void TIFFSwabArrayOfTriples(uint8 *tp , tmsize_t n ) ;
2435 extern void TIFFSwabArrayOfLong(uint32 *lp , tmsize_t n ) ;   2435 extern void TIFFSwabArrayOfLong(uint32 *lp , tmsize_t n ) ;
2436 extern void TIFFSwabArrayOfLong8(uint64 *lp , tmsize_t n ) ;   2436 extern void TIFFSwabArrayOfLong8(uint64 *lp , tmsize_t n ) ;
2437 extern void TIFFSwabArrayOfFloat(float *fp , tmsize_t n ) ;   2437 extern void TIFFSwabArrayOfFloat(float *fp , tmsize_t n ) ;
2438 extern void TIFFSwabArrayOfDouble(double *dp , tmsize_t n ) ;   2438 extern void TIFFSwabArrayOfDouble(double *dp , tmsize_t n ) ;
2439 extern void TIFFReverseBits(uint8 *cp , tmsize_t n ) ;   2439 extern void TIFFReverseBits(uint8 *cp , tmsize_t n ) ;
2440 extern unsigned char const   *TIFFGetBitRevTable(int  ) ;   2440 extern unsigned char const   *TIFFGetBitRevTable(int  ) ;
2441 extern double LogL16toY(int  ) ;   2441 extern double LogL16toY(int  ) ;
2442 extern double LogL10toY(int  ) ;   2442 extern double LogL10toY(int  ) ;
2443 extern void XYZtoRGB24(float * , uint8 * ) ;   2443 extern void XYZtoRGB24(float * , uint8 * ) ;
2444 extern int uv_decode(double * , double * , int  ) ;   2444 extern int uv_decode(double * , double * , int  ) ;
2445 extern void LogLuv24toXYZ(uint32  , float * ) ;   2445 extern void LogLuv24toXYZ(uint32  , float * ) ;
2446 extern void LogLuv32toXYZ(uint32  , float * ) ;   2446 extern void LogLuv32toXYZ(uint32  , float * ) ;
2447 extern int LogL16fromY(double  , int  ) ;   2447 extern int LogL16fromY(double  , int  ) ;
2448 extern int LogL10fromY(double  , int  ) ;   2448 extern int LogL10fromY(double  , int  ) ;
2449 extern int uv_encode(double  , double  , int  ) ;   2449 extern int uv_encode(double  , double  , int  ) ;
2450 extern uint32 LogLuv24fromXYZ(float * , int  ) ;   2450 extern uint32 LogLuv24fromXYZ(float * , int  ) ;
2451 extern uint32 LogLuv32fromXYZ(float * , int  ) ;   2451 extern uint32 LogLuv32fromXYZ(float * , int  ) ;
2452 extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB * , TIFFDisplay * , float * ) ;   2452 extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB * , TIFFDisplay * , float * ) ;
2453 extern void TIFFCIELabToXYZ(TIFFCIELabToRGB * , uint32  , int32  , int32  ,   2453 extern void TIFFCIELabToXYZ(TIFFCIELabToRGB * , uint32  , int32  , int32  ,
2454                             float * , float * , float * ) ;   2454                             float * , float * , float * ) ;
2455 extern void TIFFXYZToRGB(TIFFCIELabToRGB * , float  , float  , float  ,   2455 extern void TIFFXYZToRGB(TIFFCIELabToRGB * , float  , float  , float  ,
2456                          uint32 * , uint32 * , uint32 * ) ;   2456                          uint32 * , uint32 * , uint32 * ) ;
2457 extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB * , float * , float * ) ;   2457 extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB * , float * , float * ) ;
2458 extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB * , uint32  , int32  , int32  ,   2458 extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB * , uint32  , int32  , int32  ,
2459                            uint32 * , uint32 * , uint32 * ) ;   2459                            uint32 * , uint32 * , uint32 * ) ;
2460 extern int TIFFMergeFieldInfo(TIFF * , TIFFFieldInfo const   * , uint32  ) ;   2460 extern int TIFFMergeFieldInfo(TIFF * , TIFFFieldInfo const   * , uint32  ) ;
2461 extern TIFFFieldInfo const   *TIFFFindFieldInfo(TIFF * , uint32  ,   2461 extern TIFFFieldInfo const   *TIFFFindFieldInfo(TIFF * , uint32  ,
2462                                                 TIFFDataType  ) ;   2462                                                 TIFFDataType  ) ;
2463 extern TIFFFieldInfo const   *TIFFFindFieldInfoByName(TIFF * , char const   * ,   2463 extern TIFFFieldInfo const   *TIFFFindFieldInfoByName(TIFF * , char const   * ,
2464                                                       TIFFDataType  ) ;   2464                                                       TIFFDataType  ) ;
2465 extern TIFFFieldArray const   *_TIFFGetFields(void) ;   2465 extern TIFFFieldArray const   *_TIFFGetFields(void) ;
2466 extern TIFFFieldArray const   *_TIFFGetExifFields(void) ;   2466 extern TIFFFieldArray const   *_TIFFGetExifFields(void) ;
2467 extern void _TIFFSetupFields(TIFF *tif , TIFFFieldArray const   *infoarray ) ;   2467 extern void _TIFFSetupFields(TIFF *tif , TIFFFieldArray const   *infoarray ) ;
2468 extern void _TIFFPrintFieldInfo(TIFF * , FILE * ) ;   2468 extern void _TIFFPrintFieldInfo(TIFF * , FILE * ) ;
2469 extern int _TIFFMergeFields(TIFF * , TIFFField const   * , uint32  ) ;   2469 extern int _TIFFMergeFields(TIFF * , TIFFField const   * , uint32  ) ;
2470 extern TIFFField const   *_TIFFFindOrRegisterField(TIFF * , uint32  ,   2470 extern TIFFField const   *_TIFFFindOrRegisterField(TIFF * , uint32  ,
2471                                                    TIFFDataType  ) ;   2471                                                    TIFFDataType  ) ;
2472 extern TIFFField *_TIFFCreateAnonField(TIFF * , uint32  , TIFFDataType  ) ;   2472 extern TIFFField *_TIFFCreateAnonField(TIFF * , uint32  , TIFFDataType  ) ;
2473 extern int _TIFFgetMode(char const   *mode , char const   *module ) ;   2473 extern int _TIFFgetMode(char const   *mode , char const   *module ) ;
2474 extern int _TIFFNoRowEncode(TIFF *tif , uint8 *pp , tmsize_t cc , uint16 s ) ;   2474 extern int _TIFFNoRowEncode(TIFF *tif , uint8 *pp , tmsize_t cc , uint16 s ) ;
2475 extern int _TIFFNoStripEncode(TIFF *tif , uint8 *pp , tmsize_t cc , uint16 s ) ;   2475 extern int _TIFFNoStripEncode(TIFF *tif , uint8 *pp , tmsize_t cc , uint16 s ) ;
2476 extern int _TIFFNoTileEncode(TIFF * , uint8 *pp , tmsize_t cc , uint16 s ) ;   2476 extern int _TIFFNoTileEncode(TIFF * , uint8 *pp , tmsize_t cc , uint16 s ) ;
2477 extern int _TIFFNoRowDecode(TIFF *tif , uint8 *pp , tmsize_t cc , uint16 s ) ;   2477 extern int _TIFFNoRowDecode(TIFF *tif , uint8 *pp , tmsize_t cc , uint16 s ) ;
2478 extern int _TIFFNoStripDecode(TIFF *tif , uint8 *pp , tmsize_t cc , uint16 s ) ;   2478 extern int _TIFFNoStripDecode(TIFF *tif , uint8 *pp , tmsize_t cc , uint16 s ) ;
2479 extern int _TIFFNoTileDecode(TIFF * , uint8 *pp , tmsize_t cc , uint16 s ) ;   2479 extern int _TIFFNoTileDecode(TIFF * , uint8 *pp , tmsize_t cc , uint16 s ) ;
2480 extern void _TIFFNoPostDecode(TIFF *tif , uint8 *buf , tmsize_t cc ) ;   2480 extern void _TIFFNoPostDecode(TIFF *tif , uint8 *buf , tmsize_t cc ) ;
2481 extern int _TIFFNoPreCode(TIFF *tif , uint16 s ) ;   2481 extern int _TIFFNoPreCode(TIFF *tif , uint16 s ) ;
2482 extern int _TIFFNoSeek(TIFF *tif , uint32 off ) ;   2482 extern int _TIFFNoSeek(TIFF *tif , uint32 off ) ;
2483 extern void _TIFFSwab16BitData(TIFF *tif , uint8 *buf , tmsize_t cc ) ;   2483 extern void _TIFFSwab16BitData(TIFF *tif , uint8 *buf , tmsize_t cc ) ;
2484 extern void _TIFFSwab24BitData(TIFF *tif , uint8 *buf , tmsize_t cc ) ;   2484 extern void _TIFFSwab24BitData(TIFF *tif , uint8 *buf , tmsize_t cc ) ;
2485 extern void _TIFFSwab32BitData(TIFF *tif , uint8 *buf , tmsize_t cc ) ;   2485 extern void _TIFFSwab32BitData(TIFF *tif , uint8 *buf , tmsize_t cc ) ;
2486 extern void _TIFFSwab64BitData(TIFF *tif , uint8 *buf , tmsize_t cc ) ;   2486 extern void _TIFFSwab64BitData(TIFF *tif , uint8 *buf , tmsize_t cc ) ;
2487 extern int TIFFFlushData1(TIFF *tif ) ;   2487 extern int TIFFFlushData1(TIFF *tif ) ;
2488 extern int TIFFDefaultDirectory(TIFF *tif ) ;   2488 extern int TIFFDefaultDirectory(TIFF *tif ) ;
2489 extern void _TIFFSetDefaultCompressionState(TIFF *tif ) ;   2489 extern void _TIFFSetDefaultCompressionState(TIFF *tif ) ;
2490 extern int _TIFFRewriteField(TIFF * , uint16  , TIFFDataType  , tmsize_t  ,   2490 extern int _TIFFRewriteField(TIFF * , uint16  , TIFFDataType  , tmsize_t  ,
2491                              void * ) ;   2491                              void * ) ;
2492 extern int TIFFSetCompressionScheme(TIFF *tif , int scheme ) ;   2492 extern int TIFFSetCompressionScheme(TIFF *tif , int scheme ) ;
2493 extern int TIFFSetDefaultCompressionState(TIFF *tif ) ;   2493 extern int TIFFSetDefaultCompressionState(TIFF *tif ) ;
2494 extern uint32 _TIFFDefaultStripSize(TIFF *tif , uint32 s ) ;   2494 extern uint32 _TIFFDefaultStripSize(TIFF *tif , uint32 s ) ;
2495 extern void _TIFFDefaultTileSize(TIFF *tif , uint32 *tw , uint32 *th ) ;   2495 extern void _TIFFDefaultTileSize(TIFF *tif , uint32 *tw , uint32 *th ) ;
2496 extern int _TIFFDataSize(TIFFDataType type ) ;   2496 extern int _TIFFDataSize(TIFFDataType type ) ;
2497 extern void _TIFFsetByteArray(void ** , void * , uint32  ) ;   2497 extern void _TIFFsetByteArray(void ** , void * , uint32  ) ;
2498 extern void _TIFFsetString(char ** , char * ) ;   2498 extern void _TIFFsetString(char ** , char * ) ;
2499 extern void _TIFFsetShortArray(uint16 ** , uint16 * , uint32  ) ;   2499 extern void _TIFFsetShortArray(uint16 ** , uint16 * , uint32  ) ;
2500 extern void _TIFFsetLongArray(uint32 ** , uint32 * , uint32  ) ;   2500 extern void _TIFFsetLongArray(uint32 ** , uint32 * , uint32  ) ;
2501 extern void _TIFFsetFloatArray(float ** , float * , uint32  ) ;   2501 extern void _TIFFsetFloatArray(float ** , float * , uint32  ) ;
2502 extern void _TIFFsetDoubleArray(double ** , double * , uint32  ) ;   2502 extern void _TIFFsetDoubleArray(double ** , double * , uint32  ) ;
2503 extern void _TIFFprintAscii(FILE * , char const   * ) ;   2503 extern void _TIFFprintAscii(FILE * , char const   * ) ;
2504 extern void _TIFFprintAsciiTag(FILE * , char const   * , char const   * ) ;   2504 extern void _TIFFprintAsciiTag(FILE * , char const   * , char const   * ) ;
2505 extern void (*_TIFFwarningHandler)(char const   * , char const   * , va_list  ) ;   2505 extern void (*_TIFFwarningHandler)(char const   * , char const   * , va_list  ) ;
2506 extern void (*_TIFFerrorHandler)(char const   * , char const   * , va_list  ) ;   2506 extern void (*_TIFFerrorHandler)(char const   * , char const   * , va_list  ) ;
2507 extern void (*_TIFFwarningHandlerExt)(thandle_t  , char const   * ,   2507 extern void (*_TIFFwarningHandlerExt)(thandle_t  , char const   * ,
2508                                       char const   * , va_list  ) ;   2508                                       char const   * , va_list  ) ;
2509 extern void (*_TIFFerrorHandlerExt)(thandle_t  , char const   * ,   2509 extern void (*_TIFFerrorHandlerExt)(thandle_t  , char const   * ,
2510                                     char const   * , va_list  ) ;   2510                                     char const   * , va_list  ) ;
2511 extern void *_TIFFCheckMalloc(TIFF *tif , tmsize_t nmemb , tmsize_t elem_size ,   2511 extern void *_TIFFCheckMalloc(TIFF *tif , tmsize_t nmemb , tmsize_t elem_size ,
2512                               char const   *what ) ;   2512                               char const   *what ) ;
2513 extern void *_TIFFCheckRealloc(TIFF *tif , void *buffer , tmsize_t nmemb ,   2513 extern void *_TIFFCheckRealloc(TIFF *tif , void *buffer , tmsize_t nmemb ,
2514                                tmsize_t elem_size , char const   *what ) ;   2514                                tmsize_t elem_size , char const   *what ) ;
2515 extern double _TIFFUInt64ToDouble(uint64  ) ;   2515 extern double _TIFFUInt64ToDouble(uint64  ) ;
2516 extern float _TIFFUInt64ToFloat(uint64  ) ;   2516 extern float _TIFFUInt64ToFloat(uint64  ) ;
2517 extern int TIFFInitDumpMode(TIFF * , int  ) ;   2517 extern int TIFFInitDumpMode(TIFF * , int  ) ;
2518 extern int TIFFInitPackBits(TIFF * , int  ) ;   2518 extern int TIFFInitPackBits(TIFF * , int  ) ;
2519 extern int TIFFInitCCITTRLE(TIFF * , int  ) ;   2519 extern int TIFFInitCCITTRLE(TIFF * , int  ) ;
2520 extern int TIFFInitCCITTRLEW(TIFF * , int  ) ;   2520 extern int TIFFInitCCITTRLEW(TIFF * , int  ) ;
2521 extern int TIFFInitCCITTFax3(TIFF * , int  ) ;   2521 extern int TIFFInitCCITTFax3(TIFF * , int  ) ;
2522 extern int TIFFInitCCITTFax4(TIFF * , int  ) ;   2522 extern int TIFFInitCCITTFax4(TIFF * , int  ) ;
2523 extern int TIFFInitThunderScan(TIFF * , int  ) ;   2523 extern int TIFFInitThunderScan(TIFF * , int  ) ;
2524 extern int TIFFInitNeXT(TIFF * , int  ) ;   2524 extern int TIFFInitNeXT(TIFF * , int  ) ;
2525 extern int TIFFInitLZW(TIFF * , int  ) ;   2525 extern int TIFFInitLZW(TIFF * , int  ) ;
2526 extern int TIFFInitZIP(TIFF * , int  ) ;   2526 extern int TIFFInitZIP(TIFF * , int  ) ;
2527 extern int TIFFInitPixarLog(TIFF * , int  ) ;   2527 extern int TIFFInitPixarLog(TIFF * , int  ) ;
2528 extern int TIFFInitSGILog(TIFF * , int  ) ;   2528 extern int TIFFInitSGILog(TIFF * , int  ) ;
2529 extern TIFFCodec _TIFFBuiltinCODECS[] ;   2529 extern TIFFCodec _TIFFBuiltinCODECS[] ;
2530 extern  __attribute__((__nothrow__)) size_t __ctype_get_mb_cur_max(void) ;   2530 extern  __attribute__((__nothrow__)) size_t __ctype_get_mb_cur_max(void) ;
2531 __inline extern  __attribute__((__nothrow__)) double ( __attribute__((__nonnull__(1))) atof)(char const   *__nptr )  __attribute__((__pure__)) ;   2531 __inline extern  __attribute__((__nothrow__)) double ( __attribute__((__nonnull__(1))) atof)(char const   *__nptr )  __attribute__((__pure__)) ;
2532 __inline extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) atoi)(char const   *__nptr )  __attribute__((__pure__)) ;   2532 __inline extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) atoi)(char const   *__nptr )  __attribute__((__pure__)) ;
2533 __inline extern  __attribute__((__nothrow__)) long ( __attribute__((__nonnull__(1))) atol)(char const   *__nptr )  __attribute__((__pure__)) ;   2533 __inline extern  __attribute__((__nothrow__)) long ( __attribute__((__nonnull__(1))) atol)(char const   *__nptr )  __attribute__((__pure__)) ;
2534 __inline extern  __attribute__((__nothrow__)) long long ( __attribute__((__nonnull__(1))) atoll)(char const   *__nptr )  __attribute__((__pure__)) ;   2534 __inline extern  __attribute__((__nothrow__)) long long ( __attribute__((__nonnull__(1))) atoll)(char const   *__nptr )  __attribute__((__pure__)) ;
2535 extern  __attribute__((__nothrow__)) double ( __attribute__((__nonnull__(1))) strtod)(char const   * __restrict  __nptr ,   2535 extern  __attribute__((__nothrow__)) double ( __attribute__((__nonnull__(1))) strtod)(char const   * __restrict  __nptr ,
2536                                                                                       char ** __restrict  __endptr ) ;   2536                                                                                       char ** __restrict  __endptr ) ;
2537 extern  __attribute__((__nothrow__)) float ( __attribute__((__nonnull__(1))) strtof)(char const   * __restrict  __nptr ,   2537 extern  __attribute__((__nothrow__)) float ( __attribute__((__nonnull__(1))) strtof)(char const   * __restrict  __nptr ,
2538                                                                                      char ** __restrict  __endptr ) ;   2538                                                                                      char ** __restrict  __endptr ) ;
2539 extern  __attribute__((__nothrow__)) long double ( __attribute__((__nonnull__(1))) strtold)(char const   * __restrict  __nptr ,   2539 extern  __attribute__((__nothrow__)) long double ( __attribute__((__nonnull__(1))) strtold)(char const   * __restrict  __nptr ,
2540                                                                                             char ** __restrict  __endptr ) ;   2540                                                                                             char ** __restrict  __endptr ) ;
2541 extern  __attribute__((__nothrow__)) long ( __attribute__((__nonnull__(1))) strtol)(char const   * __restrict  __nptr ,   2541 extern  __attribute__((__nothrow__)) long ( __attribute__((__nonnull__(1))) strtol)(char const   * __restrict  __nptr ,
2542                                                                                     char ** __restrict  __endptr ,   2542                                                                                     char ** __restrict  __endptr ,
2543                                                                                     int __base ) ;   2543                                                                                     int __base ) ;
2544 extern  __attribute__((__nothrow__)) unsigned long ( __attribute__((__nonnull__(1))) strtoul)(char const   * __restrict  __nptr ,   2544 extern  __attribute__((__nothrow__)) unsigned long ( __attribute__((__nonnull__(1))) strtoul)(char const   * __restrict  __nptr ,
2545                                                                                               char ** __restrict  __endptr ,   2545                                                                                               char ** __restrict  __endptr ,
2546                                                                                               int __base ) ;   2546                                                                                               int __base ) ;
2547 extern  __attribute__((__nothrow__)) long long ( __attribute__((__nonnull__(1))) strtoq)(char const   * __restrict  __nptr ,   2547 extern  __attribute__((__nothrow__)) long long ( __attribute__((__nonnull__(1))) strtoq)(char const   * __restrict  __nptr ,
2548                                                                                          char ** __restrict  __endptr ,   2548                                                                                          char ** __restrict  __endptr ,
2549                                                                                          int __base ) ;   2549                                                                                          int __base ) ;
2550 extern  __attribute__((__nothrow__)) unsigned long long ( __attribute__((__nonnull__(1))) strtouq)(char const   * __restrict  __nptr ,   2550 extern  __attribute__((__nothrow__)) unsigned long long ( __attribute__((__nonnull__(1))) strtouq)(char const   * __restrict  __nptr ,
2551                                                                                                    char ** __restrict  __endptr ,   2551                                                                                                    char ** __restrict  __endptr ,
2552                                                                                                    int __base ) ;   2552                                                                                                    int __base ) ;
2553 extern  __attribute__((__nothrow__)) long long ( __attribute__((__nonnull__(1))) strtoll)(char const   * __restrict  __nptr ,   2553 extern  __attribute__((__nothrow__)) long long ( __attribute__((__nonnull__(1))) strtoll)(char const   * __restrict  __nptr ,
2554                                                                                           char ** __restrict  __endptr ,   2554                                                                                           char ** __restrict  __endptr ,
2555                                                                                           int __base ) ;   2555                                                                                           int __base ) ;
2556 extern  __attribute__((__nothrow__)) unsigned long long ( __attribute__((__nonnull__(1))) strtoull)(char const   * __restrict  __nptr ,   2556 extern  __attribute__((__nothrow__)) unsigned long long ( __attribute__((__nonnull__(1))) strtoull)(char const   * __restrict  __nptr ,
2557                                                                                                     char ** __restrict  __endptr ,   2557                                                                                                     char ** __restrict  __endptr ,
2558                                                                                                     int __base ) ;   2558                                                                                                     int __base ) ;
2559 __inline extern  __attribute__((__nothrow__)) double ( __attribute__((__nonnull__(1))) atof)(char const   *__nptr )  __attribute__((__pure__)) ;   2559 __inline extern  __attribute__((__nothrow__)) double ( __attribute__((__nonnull__(1))) atof)(char const   *__nptr )  __attribute__((__pure__)) ;
2560 __inline extern double ( __attribute__((__nonnull__(1))) atof)(char const   *__nptr )   2560 __inline extern double ( __attribute__((__nonnull__(1))) atof)(char const   *__nptr )
2561 {   2561 {
2562   double tmp ;   2562   double tmp ;
2563     2563  
2564   {   2564   {
2565   tmp = strtod((char const   */* __restrict  */)__nptr,   2565   tmp = strtod((char const   */* __restrict  */)__nptr,
2566                (char **/* __restrict  */)((char **)((void *)0)));   2566                (char **/* __restrict  */)((char **)((void *)0)));
2567   return (tmp);   2567   return (tmp);
2568 }   2568 }
2569 }   2569 }
2570 __inline extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) atoi)(char const   *__nptr )  __attribute__((__pure__)) ;   2570 __inline extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) atoi)(char const   *__nptr )  __attribute__((__pure__)) ;
2571 __inline extern int ( __attribute__((__nonnull__(1))) atoi)(char const   *__nptr )   2571 __inline extern int ( __attribute__((__nonnull__(1))) atoi)(char const   *__nptr )
2572 {   2572 {
2573   long tmp ;   2573   long tmp ;
2574     2574  
2575   {   2575   {
2576   tmp = strtol((char const   */* __restrict  */)__nptr,   2576   tmp = strtol((char const   */* __restrict  */)__nptr,
2577                (char **/* __restrict  */)((char **)((void *)0)), 10);   2577                (char **/* __restrict  */)((char **)((void *)0)), 10);
2578   return ((int )tmp);   2578   return ((int )tmp);
2579 }   2579 }
2580 }   2580 }
2581 __inline extern  __attribute__((__nothrow__)) long ( __attribute__((__nonnull__(1))) atol)(char const   *__nptr )  __attribute__((__pure__)) ;   2581 __inline extern  __attribute__((__nothrow__)) long ( __attribute__((__nonnull__(1))) atol)(char const   *__nptr )  __attribute__((__pure__)) ;
2582 __inline extern long ( __attribute__((__nonnull__(1))) atol)(char const   *__nptr )   2582 __inline extern long ( __attribute__((__nonnull__(1))) atol)(char const   *__nptr )
2583 {   2583 {
2584   long tmp ;   2584   long tmp ;
2585     2585  
2586   {   2586   {
2587   tmp = strtol((char const   */* __restrict  */)__nptr,   2587   tmp = strtol((char const   */* __restrict  */)__nptr,
2588                (char **/* __restrict  */)((char **)((void *)0)), 10);   2588                (char **/* __restrict  */)((char **)((void *)0)), 10);
2589   return (tmp);   2589   return (tmp);
2590 }   2590 }
2591 }   2591 }
2592 __inline extern  __attribute__((__nothrow__)) long long ( __attribute__((__nonnull__(1))) atoll)(char const   *__nptr )  __attribute__((__pure__)) ;   2592 __inline extern  __attribute__((__nothrow__)) long long ( __attribute__((__nonnull__(1))) atoll)(char const   *__nptr )  __attribute__((__pure__)) ;
2593 __inline extern long long ( __attribute__((__nonnull__(1))) atoll)(char const   *__nptr )   2593 __inline extern long long ( __attribute__((__nonnull__(1))) atoll)(char const   *__nptr )
2594 {   2594 {
2595   long long tmp ;   2595   long long tmp ;
2596     2596  
2597   {   2597   {
2598   tmp = strtoll((char const   */* __restrict  */)__nptr,   2598   tmp = strtoll((char const   */* __restrict  */)__nptr,
2599                 (char **/* __restrict  */)((char **)((void *)0)), 10);   2599                 (char **/* __restrict  */)((char **)((void *)0)), 10);
2600   return (tmp);   2600   return (tmp);
2601 }   2601 }
2602 }   2602 }
2603 extern  __attribute__((__nothrow__)) char *l64a(long __n ) ;   2603 extern  __attribute__((__nothrow__)) char *l64a(long __n ) ;
2604 extern  __attribute__((__nothrow__)) long ( __attribute__((__nonnull__(1))) a64l)(char const   *__s )  __attribute__((__pure__)) ;   2604 extern  __attribute__((__nothrow__)) long ( __attribute__((__nonnull__(1))) a64l)(char const   *__s )  __attribute__((__pure__)) ;
2605 extern  __attribute__((__nothrow__)) long random(void) ;   2605 extern  __attribute__((__nothrow__)) long random(void) ;
2606 extern  __attribute__((__nothrow__)) void srandom(unsigned int __seed ) ;   2606 extern  __attribute__((__nothrow__)) void srandom(unsigned int __seed ) ;
2607 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(2))) initstate)(unsigned int __seed ,   2607 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(2))) initstate)(unsigned int __seed ,
2608                                                                                         char *__statebuf ,   2608                                                                                         char *__statebuf ,
2609                                                                                         size_t __statelen ) ;   2609                                                                                         size_t __statelen ) ;
2610 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1))) setstate)(char *__statebuf ) ;   2610 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1))) setstate)(char *__statebuf ) ;
2611 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) random_r)(struct random_data * __restrict  __buf ,   2611 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) random_r)(struct random_data * __restrict  __buf ,
2612                                                                                        int32_t * __restrict  __result ) ;   2612                                                                                        int32_t * __restrict  __result ) ;
2613 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) srandom_r)(unsigned int __seed ,   2613 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) srandom_r)(unsigned int __seed ,
2614                                                                                       struct random_data *__buf ) ;   2614                                                                                       struct random_data *__buf ) ;
2615 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2,4))) initstate_r)(unsigned int __seed ,   2615 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2,4))) initstate_r)(unsigned int __seed ,
2616                                                                                           char * __restrict  __statebuf ,   2616                                                                                           char * __restrict  __statebuf ,
2617                                                                                           size_t __statelen ,   2617                                                                                           size_t __statelen ,
2618                                                                                           struct random_data * __restrict  __buf ) ;   2618                                                                                           struct random_data * __restrict  __buf ) ;
2619 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) setstate_r)(char * __restrict  __statebuf ,   2619 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) setstate_r)(char * __restrict  __statebuf ,
2620                                                                                          struct random_data * __restrict  __buf ) ;   2620                                                                                          struct random_data * __restrict  __buf ) ;
2621 extern  __attribute__((__nothrow__)) int rand(void) ;   2621 extern  __attribute__((__nothrow__)) int rand(void) ;
2622 extern  __attribute__((__nothrow__)) void srand(unsigned int __seed ) ;   2622 extern  __attribute__((__nothrow__)) void srand(unsigned int __seed ) ;
2623 extern  __attribute__((__nothrow__)) int rand_r(unsigned int *__seed ) ;   2623 extern  __attribute__((__nothrow__)) int rand_r(unsigned int *__seed ) ;
2624 extern  __attribute__((__nothrow__)) double drand48(void) ;   2624 extern  __attribute__((__nothrow__)) double drand48(void) ;
2625 extern  __attribute__((__nothrow__)) double ( __attribute__((__nonnull__(1))) erand48)(unsigned short *__xsubi ) ;   2625 extern  __attribute__((__nothrow__)) double ( __attribute__((__nonnull__(1))) erand48)(unsigned short *__xsubi ) ;
2626 extern  __attribute__((__nothrow__)) long lrand48(void) ;   2626 extern  __attribute__((__nothrow__)) long lrand48(void) ;
2627 extern  __attribute__((__nothrow__)) long ( __attribute__((__nonnull__(1))) nrand48)(unsigned short *__xsubi ) ;   2627 extern  __attribute__((__nothrow__)) long ( __attribute__((__nonnull__(1))) nrand48)(unsigned short *__xsubi ) ;
2628 extern  __attribute__((__nothrow__)) long mrand48(void) ;   2628 extern  __attribute__((__nothrow__)) long mrand48(void) ;
2629 extern  __attribute__((__nothrow__)) long ( __attribute__((__nonnull__(1))) jrand48)(unsigned short *__xsubi ) ;   2629 extern  __attribute__((__nothrow__)) long ( __attribute__((__nonnull__(1))) jrand48)(unsigned short *__xsubi ) ;
2630 extern  __attribute__((__nothrow__)) void srand48(long __seedval ) ;   2630 extern  __attribute__((__nothrow__)) void srand48(long __seedval ) ;
2631 extern  __attribute__((__nothrow__)) unsigned short *( __attribute__((__nonnull__(1))) seed48)(unsigned short *__seed16v ) ;   2631 extern  __attribute__((__nothrow__)) unsigned short *( __attribute__((__nonnull__(1))) seed48)(unsigned short *__seed16v ) ;
2632 extern  __attribute__((__nothrow__)) void ( __attribute__((__nonnull__(1))) lcong48)(unsigned short *__param ) ;   2632 extern  __attribute__((__nothrow__)) void ( __attribute__((__nonnull__(1))) lcong48)(unsigned short *__param ) ;
2633 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) drand48_r)(struct drand48_data * __restrict  __buffer ,   2633 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) drand48_r)(struct drand48_data * __restrict  __buffer ,
2634                                                                                         double * __restrict  __result ) ;   2634                                                                                         double * __restrict  __result ) ;
2635 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) erand48_r)(unsigned short *__xsubi ,   2635 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) erand48_r)(unsigned short *__xsubi ,
2636                                                                                         struct drand48_data * __restrict  __buffer ,   2636                                                                                         struct drand48_data * __restrict  __buffer ,
2637                                                                                         double * __restrict  __result ) ;   2637                                                                                         double * __restrict  __result ) ;
2638 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) lrand48_r)(struct drand48_data * __restrict  __buffer ,   2638 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) lrand48_r)(struct drand48_data * __restrict  __buffer ,
2639                                                                                         long * __restrict  __result ) ;   2639                                                                                         long * __restrict  __result ) ;
2640 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) nrand48_r)(unsigned short *__xsubi ,   2640 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) nrand48_r)(unsigned short *__xsubi ,
2641                                                                                         struct drand48_data * __restrict  __buffer ,   2641                                                                                         struct drand48_data * __restrict  __buffer ,
2642                                                                                         long * __restrict  __result ) ;   2642                                                                                         long * __restrict  __result ) ;
2643 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) mrand48_r)(struct drand48_data * __restrict  __buffer ,   2643 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) mrand48_r)(struct drand48_data * __restrict  __buffer ,
2644                                                                                         long * __restrict  __result ) ;   2644                                                                                         long * __restrict  __result ) ;
2645 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) jrand48_r)(unsigned short *__xsubi ,   2645 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) jrand48_r)(unsigned short *__xsubi ,
2646                                                                                         struct drand48_data * __restrict  __buffer ,   2646                                                                                         struct drand48_data * __restrict  __buffer ,
2647                                                                                         long * __restrict  __result ) ;   2647                                                                                         long * __restrict  __result ) ;
2648 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) srand48_r)(long __seedval ,   2648 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) srand48_r)(long __seedval ,
2649                                                                                       struct drand48_data *__buffer ) ;   2649                                                                                       struct drand48_data *__buffer ) ;
2650 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) seed48_r)(unsigned short *__seed16v ,   2650 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) seed48_r)(unsigned short *__seed16v ,
2651                                                                                        struct drand48_data *__buffer ) ;   2651                                                                                        struct drand48_data *__buffer ) ;
2652 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) lcong48_r)(unsigned short *__param ,   2652 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) lcong48_r)(unsigned short *__param ,
2653                                                                                         struct drand48_data *__buffer ) ;   2653                                                                                         struct drand48_data *__buffer ) ;
2654 extern  __attribute__((__nothrow__)) void *( __attribute__((__warn_unused_result__)) realloc)(void *__ptr ,   2654 extern  __attribute__((__nothrow__)) void *( __attribute__((__warn_unused_result__)) realloc)(void *__ptr ,
2655                                                                                               size_t __size ) ;   2655                                                                                               size_t __size ) ;
2656 extern  __attribute__((__nothrow__)) void free(void *__ptr ) ;   2656 extern  __attribute__((__nothrow__)) void free(void *__ptr ) ;
2657 extern  __attribute__((__nothrow__)) void cfree(void *__ptr ) ;   2657 extern  __attribute__((__nothrow__)) void cfree(void *__ptr ) ;
2658 extern  __attribute__((__nothrow__)) void *alloca(size_t __size ) ;   2658 extern  __attribute__((__nothrow__)) void *alloca(size_t __size ) ;
2659 extern  __attribute__((__nothrow__)) void *valloc(size_t __size )  __attribute__((__malloc__)) ;   2659 extern  __attribute__((__nothrow__)) void *valloc(size_t __size )  __attribute__((__malloc__)) ;
2660 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) posix_memalign)(void **__memptr ,   2660 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) posix_memalign)(void **__memptr ,
2661                                                                                            size_t __alignment ,   2661                                                                                            size_t __alignment ,
2662                                                                                            size_t __size ) ;   2662                                                                                            size_t __size ) ;
2663 extern  __attribute__((__nothrow__, __noreturn__)) void abort(void) ;   2663 extern  __attribute__((__nothrow__, __noreturn__)) void abort(void) ;
2664 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) atexit)(void (*__func)(void) ) ;   2664 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) atexit)(void (*__func)(void) ) ;
2665 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) on_exit)(void (*__func)(int __status ,   2665 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) on_exit)(void (*__func)(int __status ,
2666                                                                                                    void *__arg ) ,   2666                                                                                                    void *__arg ) ,
2667                                                                                     void *__arg ) ;   2667                                                                                     void *__arg ) ;
2668 extern  __attribute__((__nothrow__, __noreturn__)) void exit(int __status ) ;   2668 extern  __attribute__((__nothrow__, __noreturn__)) void exit(int __status ) ;
2669 extern  __attribute__((__nothrow__, __noreturn__)) void _Exit(int __status ) ;   2669 extern  __attribute__((__nothrow__, __noreturn__)) void _Exit(int __status ) ;
2670 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1))) getenv)(char const   *__name ) ;   2670 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1))) getenv)(char const   *__name ) ;
2671 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1))) __secure_getenv)(char const   *__name ) ;   2671 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1))) __secure_getenv)(char const   *__name ) ;
2672 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) putenv)(char *__string ) ;   2672 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) putenv)(char *__string ) ;
2673 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) setenv)(char const   *__name ,   2673 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) setenv)(char const   *__name ,
2674                                                                                    char const   *__value ,   2674                                                                                    char const   *__value ,
2675                                                                                    int __replace ) ;   2675                                                                                    int __replace ) ;
2676 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) unsetenv)(char const   *__name ) ;   2676 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) unsetenv)(char const   *__name ) ;
2677 extern  __attribute__((__nothrow__)) int clearenv(void) ;   2677 extern  __attribute__((__nothrow__)) int clearenv(void) ;
2678 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1))) mktemp)(char *__template ) ;   2678 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1))) mktemp)(char *__template ) ;
2679 extern int ( __attribute__((__nonnull__(1))) mkstemp)(char *__template )  __asm__("mkstemp64")  ;   2679 extern int ( __attribute__((__nonnull__(1))) mkstemp)(char *__template )  __asm__("mkstemp64")  ;
2680 extern int ( __attribute__((__nonnull__(1))) mkstemps)(char *__template ,   2680 extern int ( __attribute__((__nonnull__(1))) mkstemps)(char *__template ,
2681                                                        int __suffixlen )  __asm__("mkstemps64")  ;   2681                                                        int __suffixlen )  __asm__("mkstemps64")  ;
2682 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1))) mkdtemp)(char *__template ) ;   2682 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1))) mkdtemp)(char *__template ) ;
2683 extern int system(char const   *__command ) ;   2683 extern int system(char const   *__command ) ;
2684 extern  __attribute__((__nothrow__)) char *realpath(char const   * __restrict  __name ,   2684 extern  __attribute__((__nothrow__)) char *realpath(char const   * __restrict  __name ,
2685                                                     char * __restrict  __resolved ) ;   2685                                                     char * __restrict  __resolved ) ;
2686 extern void *( __attribute__((__nonnull__(1,2,5))) bsearch)(void const   *__key ,   2686 extern void *( __attribute__((__nonnull__(1,2,5))) bsearch)(void const   *__key ,
2687                                                             void const   *__base ,   2687                                                             void const   *__base ,
2688                                                             size_t __nmemb ,   2688                                                             size_t __nmemb ,
2689                                                             size_t __size ,   2689                                                             size_t __size ,
2690                                                             int (*__compar)(void const   * ,   2690                                                             int (*__compar)(void const   * ,
2691                                                                             void const   * ) ) ;   2691                                                                             void const   * ) ) ;
2692 extern void ( __attribute__((__nonnull__(1,4))) qsort)(void *__base ,   2692 extern void ( __attribute__((__nonnull__(1,4))) qsort)(void *__base ,
2693                                                        size_t __nmemb ,   2693                                                        size_t __nmemb ,
2694                                                        size_t __size ,   2694                                                        size_t __size ,
2695                                                        int (*__compar)(void const   * ,   2695                                                        int (*__compar)(void const   * ,
2696                                                                        void const   * ) ) ;   2696                                                                        void const   * ) ) ;
2697 extern  __attribute__((__nothrow__)) int abs(int __x )  __attribute__((__const__)) ;   2697 extern  __attribute__((__nothrow__)) int abs(int __x )  __attribute__((__const__)) ;
2698 extern  __attribute__((__nothrow__)) long labs(long __x )  __attribute__((__const__)) ;   2698 extern  __attribute__((__nothrow__)) long labs(long __x )  __attribute__((__const__)) ;
2699 extern  __attribute__((__nothrow__)) long long llabs(long long __x )  __attribute__((__const__)) ;   2699 extern  __attribute__((__nothrow__)) long long llabs(long long __x )  __attribute__((__const__)) ;
2700 extern  __attribute__((__nothrow__)) div_t div(int __numer , int __denom )  __attribute__((__const__)) ;   2700 extern  __attribute__((__nothrow__)) div_t div(int __numer , int __denom )  __attribute__((__const__)) ;
2701 extern  __attribute__((__nothrow__)) ldiv_t ldiv(long __numer , long __denom )  __attribute__((__const__)) ;   2701 extern  __attribute__((__nothrow__)) ldiv_t ldiv(long __numer , long __denom )  __attribute__((__const__)) ;
2702 extern  __attribute__((__nothrow__)) lldiv_t lldiv(long long __numer ,   2702 extern  __attribute__((__nothrow__)) lldiv_t lldiv(long long __numer ,
2703                                                    long long __denom )  __attribute__((__const__)) ;   2703                                                    long long __denom )  __attribute__((__const__)) ;
2704 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(3,4))) ecvt)(double __value ,   2704 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(3,4))) ecvt)(double __value ,
2705                                                                                      int __ndigit ,   2705                                                                                      int __ndigit ,
2706                                                                                      int * __restrict  __decpt ,   2706                                                                                      int * __restrict  __decpt ,
2707                                                                                      int * __restrict  __sign ) ;   2707                                                                                      int * __restrict  __sign ) ;
2708 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(3,4))) fcvt)(double __value ,   2708 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(3,4))) fcvt)(double __value ,
2709                                                                                      int __ndigit ,   2709                                                                                      int __ndigit ,
2710                                                                                      int * __restrict  __decpt ,   2710                                                                                      int * __restrict  __decpt ,
2711                                                                                      int * __restrict  __sign ) ;   2711                                                                                      int * __restrict  __sign ) ;
2712 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(3))) gcvt)(double __value ,   2712 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(3))) gcvt)(double __value ,
2713                                                                                    int __ndigit ,   2713                                                                                    int __ndigit ,
2714                                                                                    char *__buf ) ;   2714                                                                                    char *__buf ) ;
2715 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(3,4))) qecvt)(long double __value ,   2715 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(3,4))) qecvt)(long double __value ,
2716                                                                                       int __ndigit ,   2716                                                                                       int __ndigit ,
2717                                                                                       int * __restrict  __decpt ,   2717                                                                                       int * __restrict  __decpt ,
2718                                                                                       int * __restrict  __sign ) ;   2718                                                                                       int * __restrict  __sign ) ;
2719 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(3,4))) qfcvt)(long double __value ,   2719 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(3,4))) qfcvt)(long double __value ,
2720                                                                                       int __ndigit ,   2720                                                                                       int __ndigit ,
2721                                                                                       int * __restrict  __decpt ,   2721                                                                                       int * __restrict  __decpt ,
2722                                                                                       int * __restrict  __sign ) ;   2722                                                                                       int * __restrict  __sign ) ;
2723 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(3))) qgcvt)(long double __value ,   2723 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(3))) qgcvt)(long double __value ,
2724                                                                                     int __ndigit ,   2724                                                                                     int __ndigit ,
2725                                                                                     char *__buf ) ;   2725                                                                                     char *__buf ) ;
2726 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(3,4,5))) ecvt_r)(double __value ,   2726 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(3,4,5))) ecvt_r)(double __value ,
2727                                                                                        int __ndigit ,   2727                                                                                        int __ndigit ,
2728                                                                                        int * __restrict  __decpt ,   2728                                                                                        int * __restrict  __decpt ,
2729                                                                                        int * __restrict  __sign ,   2729                                                                                        int * __restrict  __sign ,
2730                                                                                        char * __restrict  __buf ,   2730                                                                                        char * __restrict  __buf ,
2731                                                                                        size_t __len ) ;   2731                                                                                        size_t __len ) ;
2732 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(3,4,5))) fcvt_r)(double __value ,   2732 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(3,4,5))) fcvt_r)(double __value ,
2733                                                                                        int __ndigit ,   2733                                                                                        int __ndigit ,
2734                                                                                        int * __restrict  __decpt ,   2734                                                                                        int * __restrict  __decpt ,
2735                                                                                        int * __restrict  __sign ,   2735                                                                                        int * __restrict  __sign ,
2736                                                                                        char * __restrict  __buf ,   2736                                                                                        char * __restrict  __buf ,
2737                                                                                        size_t __len ) ;   2737                                                                                        size_t __len ) ;
2738 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(3,4,5))) qecvt_r)(long double __value ,   2738 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(3,4,5))) qecvt_r)(long double __value ,
2739                                                                                         int __ndigit ,   2739                                                                                         int __ndigit ,
2740                                                                                         int * __restrict  __decpt ,   2740                                                                                         int * __restrict  __decpt ,
2741                                                                                         int * __restrict  __sign ,   2741                                                                                         int * __restrict  __sign ,
2742                                                                                         char * __restrict  __buf ,   2742                                                                                         char * __restrict  __buf ,
2743                                                                                         size_t __len ) ;   2743                                                                                         size_t __len ) ;
2744 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(3,4,5))) qfcvt_r)(long double __value ,   2744 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(3,4,5))) qfcvt_r)(long double __value ,
2745                                                                                         int __ndigit ,   2745                                                                                         int __ndigit ,
2746                                                                                         int * __restrict  __decpt ,   2746                                                                                         int * __restrict  __decpt ,
2747                                                                                         int * __restrict  __sign ,   2747                                                                                         int * __restrict  __sign ,
2748                                                                                         char * __restrict  __buf ,   2748                                                                                         char * __restrict  __buf ,
2749                                                                                         size_t __len ) ;   2749                                                                                         size_t __len ) ;
2750 extern  __attribute__((__nothrow__)) int mblen(char const   *__s , size_t __n ) ;   2750 extern  __attribute__((__nothrow__)) int mblen(char const   *__s , size_t __n ) ;
2751 extern  __attribute__((__nothrow__)) int mbtowc(wchar_t * __restrict  __pwc ,   2751 extern  __attribute__((__nothrow__)) int mbtowc(wchar_t * __restrict  __pwc ,
2752                                                 char const   * __restrict  __s ,   2752                                                 char const   * __restrict  __s ,
2753                                                 size_t __n ) ;   2753                                                 size_t __n ) ;
2754 extern  __attribute__((__nothrow__)) int wctomb(char *__s , wchar_t __wchar ) ;   2754 extern  __attribute__((__nothrow__)) int wctomb(char *__s , wchar_t __wchar ) ;
2755 extern  __attribute__((__nothrow__)) size_t mbstowcs(wchar_t * __restrict  __pwcs ,   2755 extern  __attribute__((__nothrow__)) size_t mbstowcs(wchar_t * __restrict  __pwcs ,
2756                                                      char const   * __restrict  __s ,   2756                                                      char const   * __restrict  __s ,
2757                                                      size_t __n ) ;   2757                                                      size_t __n ) ;
2758 extern  __attribute__((__nothrow__)) size_t wcstombs(char * __restrict  __s ,   2758 extern  __attribute__((__nothrow__)) size_t wcstombs(char * __restrict  __s ,
2759                                                      wchar_t const   * __restrict  __pwcs ,   2759                                                      wchar_t const   * __restrict  __pwcs ,
2760                                                      size_t __n ) ;   2760                                                      size_t __n ) ;
2761 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) rpmatch)(char const   *__response ) ;   2761 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) rpmatch)(char const   *__response ) ;
2762 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2,3))) getsubopt)(char ** __restrict  __optionp ,   2762 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2,3))) getsubopt)(char ** __restrict  __optionp ,
2763                                                                                           char * const  * __restrict  __tokens ,   2763                                                                                           char * const  * __restrict  __tokens ,
2764                                                                                           char ** __restrict  __valuep ) ;   2764                                                                                           char ** __restrict  __valuep ) ;
2765 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) getloadavg)(double *__loadavg ,   2765 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) getloadavg)(double *__loadavg ,
2766                                                                                        int __nelem ) ;   2766                                                                                        int __nelem ) ;
2767 extern  __attribute__((__nothrow__)) double acos(double __x ) ;   2767 extern  __attribute__((__nothrow__)) double acos(double __x ) ;
2768 extern  __attribute__((__nothrow__)) double __acos(double __x ) ;   2768 extern  __attribute__((__nothrow__)) double __acos(double __x ) ;
2769 extern  __attribute__((__nothrow__)) double asin(double __x ) ;   2769 extern  __attribute__((__nothrow__)) double asin(double __x ) ;
2770 extern  __attribute__((__nothrow__)) double __asin(double __x ) ;   2770 extern  __attribute__((__nothrow__)) double __asin(double __x ) ;
2771 extern  __attribute__((__nothrow__)) double atan(double __x ) ;   2771 extern  __attribute__((__nothrow__)) double atan(double __x ) ;
2772 extern  __attribute__((__nothrow__)) double __atan(double __x ) ;   2772 extern  __attribute__((__nothrow__)) double __atan(double __x ) ;
2773 extern  __attribute__((__nothrow__)) double atan2(double __y , double __x ) ;   2773 extern  __attribute__((__nothrow__)) double atan2(double __y , double __x ) ;
2774 extern  __attribute__((__nothrow__)) double __atan2(double __y , double __x ) ;   2774 extern  __attribute__((__nothrow__)) double __atan2(double __y , double __x ) ;
2775 extern  __attribute__((__nothrow__)) double cos(double __x ) ;   2775 extern  __attribute__((__nothrow__)) double cos(double __x ) ;
2776 extern  __attribute__((__nothrow__)) double __cos(double __x ) ;   2776 extern  __attribute__((__nothrow__)) double __cos(double __x ) ;
2777 extern  __attribute__((__nothrow__)) double sin(double __x ) ;   2777 extern  __attribute__((__nothrow__)) double sin(double __x ) ;
2778 extern  __attribute__((__nothrow__)) double __sin(double __x ) ;   2778 extern  __attribute__((__nothrow__)) double __sin(double __x ) ;
2779 extern  __attribute__((__nothrow__)) double tan(double __x ) ;   2779 extern  __attribute__((__nothrow__)) double tan(double __x ) ;
2780 extern  __attribute__((__nothrow__)) double __tan(double __x ) ;   2780 extern  __attribute__((__nothrow__)) double __tan(double __x ) ;
2781 extern  __attribute__((__nothrow__)) double cosh(double __x ) ;   2781 extern  __attribute__((__nothrow__)) double cosh(double __x ) ;
2782 extern  __attribute__((__nothrow__)) double __cosh(double __x ) ;   2782 extern  __attribute__((__nothrow__)) double __cosh(double __x ) ;
2783 extern  __attribute__((__nothrow__)) double sinh(double __x ) ;   2783 extern  __attribute__((__nothrow__)) double sinh(double __x ) ;
2784 extern  __attribute__((__nothrow__)) double __sinh(double __x ) ;   2784 extern  __attribute__((__nothrow__)) double __sinh(double __x ) ;
2785 extern  __attribute__((__nothrow__)) double tanh(double __x ) ;   2785 extern  __attribute__((__nothrow__)) double tanh(double __x ) ;
2786 extern  __attribute__((__nothrow__)) double __tanh(double __x ) ;   2786 extern  __attribute__((__nothrow__)) double __tanh(double __x ) ;
2787 extern  __attribute__((__nothrow__)) double acosh(double __x ) ;   2787 extern  __attribute__((__nothrow__)) double acosh(double __x ) ;
2788 extern  __attribute__((__nothrow__)) double __acosh(double __x ) ;   2788 extern  __attribute__((__nothrow__)) double __acosh(double __x ) ;
2789 extern  __attribute__((__nothrow__)) double asinh(double __x ) ;   2789 extern  __attribute__((__nothrow__)) double asinh(double __x ) ;
2790 extern  __attribute__((__nothrow__)) double __asinh(double __x ) ;   2790 extern  __attribute__((__nothrow__)) double __asinh(double __x ) ;
2791 extern  __attribute__((__nothrow__)) double atanh(double __x ) ;   2791 extern  __attribute__((__nothrow__)) double atanh(double __x ) ;
2792 extern  __attribute__((__nothrow__)) double __atanh(double __x ) ;   2792 extern  __attribute__((__nothrow__)) double __atanh(double __x ) ;
2793 extern  __attribute__((__nothrow__)) double exp(double __x ) ;   2793 extern  __attribute__((__nothrow__)) double exp(double __x ) ;
2794 extern  __attribute__((__nothrow__)) double __exp(double __x ) ;   2794 extern  __attribute__((__nothrow__)) double __exp(double __x ) ;
2795 extern  __attribute__((__nothrow__)) double frexp(double __x , int *__exponent ) ;   2795 extern  __attribute__((__nothrow__)) double frexp(double __x , int *__exponent ) ;
2796 extern  __attribute__((__nothrow__)) double __frexp(double __x ,   2796 extern  __attribute__((__nothrow__)) double __frexp(double __x ,
2797                                                     int *__exponent ) ;   2797                                                     int *__exponent ) ;
2798 extern  __attribute__((__nothrow__)) double ldexp(double __x , int __exponent ) ;   2798 extern  __attribute__((__nothrow__)) double ldexp(double __x , int __exponent ) ;
2799 extern  __attribute__((__nothrow__)) double __ldexp(double __x , int __exponent ) ;   2799 extern  __attribute__((__nothrow__)) double __ldexp(double __x , int __exponent ) ;
2800 extern  __attribute__((__nothrow__)) double log(double __x ) ;   2800 extern  __attribute__((__nothrow__)) double log(double __x ) ;
2801 extern  __attribute__((__nothrow__)) double __log(double __x ) ;   2801 extern  __attribute__((__nothrow__)) double __log(double __x ) ;
2802 extern  __attribute__((__nothrow__)) double log10(double __x ) ;   2802 extern  __attribute__((__nothrow__)) double log10(double __x ) ;
2803 extern  __attribute__((__nothrow__)) double __log10(double __x ) ;   2803 extern  __attribute__((__nothrow__)) double __log10(double __x ) ;
2804 extern  __attribute__((__nothrow__)) double modf(double __x , double *__iptr ) ;   2804 extern  __attribute__((__nothrow__)) double modf(double __x , double *__iptr ) ;
2805 extern  __attribute__((__nothrow__)) double __modf(double __x , double *__iptr ) ;   2805 extern  __attribute__((__nothrow__)) double __modf(double __x , double *__iptr ) ;
2806 extern  __attribute__((__nothrow__)) double expm1(double __x ) ;   2806 extern  __attribute__((__nothrow__)) double expm1(double __x ) ;
2807 extern  __attribute__((__nothrow__)) double __expm1(double __x ) ;   2807 extern  __attribute__((__nothrow__)) double __expm1(double __x ) ;
2808 extern  __attribute__((__nothrow__)) double log1p(double __x ) ;   2808 extern  __attribute__((__nothrow__)) double log1p(double __x ) ;
2809 extern  __attribute__((__nothrow__)) double __log1p(double __x ) ;   2809 extern  __attribute__((__nothrow__)) double __log1p(double __x ) ;
2810 extern  __attribute__((__nothrow__)) double logb(double __x ) ;   2810 extern  __attribute__((__nothrow__)) double logb(double __x ) ;
2811 extern  __attribute__((__nothrow__)) double __logb(double __x ) ;   2811 extern  __attribute__((__nothrow__)) double __logb(double __x ) ;
2812 extern  __attribute__((__nothrow__)) double exp2(double __x ) ;   2812 extern  __attribute__((__nothrow__)) double exp2(double __x ) ;
2813 extern  __attribute__((__nothrow__)) double __exp2(double __x ) ;   2813 extern  __attribute__((__nothrow__)) double __exp2(double __x ) ;
2814 extern  __attribute__((__nothrow__)) double log2(double __x ) ;   2814 extern  __attribute__((__nothrow__)) double log2(double __x ) ;
2815 extern  __attribute__((__nothrow__)) double __log2(double __x ) ;   2815 extern  __attribute__((__nothrow__)) double __log2(double __x ) ;
2816 extern  __attribute__((__nothrow__)) double pow(double __x , double __y ) ;   2816 extern  __attribute__((__nothrow__)) double pow(double __x , double __y ) ;
2817 extern  __attribute__((__nothrow__)) double __pow(double __x , double __y ) ;   2817 extern  __attribute__((__nothrow__)) double __pow(double __x , double __y ) ;
2818 extern  __attribute__((__nothrow__)) double sqrt(double __x ) ;   2818 extern  __attribute__((__nothrow__)) double sqrt(double __x ) ;
2819 extern  __attribute__((__nothrow__)) double __sqrt(double __x ) ;   2819 extern  __attribute__((__nothrow__)) double __sqrt(double __x ) ;
2820 extern  __attribute__((__nothrow__)) double hypot(double __x , double __y ) ;   2820 extern  __attribute__((__nothrow__)) double hypot(double __x , double __y ) ;
2821 extern  __attribute__((__nothrow__)) double __hypot(double __x , double __y ) ;   2821 extern  __attribute__((__nothrow__)) double __hypot(double __x , double __y ) ;
2822 extern  __attribute__((__nothrow__)) double cbrt(double __x ) ;   2822 extern  __attribute__((__nothrow__)) double cbrt(double __x ) ;
2823 extern  __attribute__((__nothrow__)) double __cbrt(double __x ) ;   2823 extern  __attribute__((__nothrow__)) double __cbrt(double __x ) ;
2824 __inline extern  __attribute__((__nothrow__)) double ceil(double __x )  __attribute__((__const__)) ;   2824 __inline extern  __attribute__((__nothrow__)) double ceil(double __x )  __attribute__((__const__)) ;
2825 extern  __attribute__((__nothrow__)) double __ceil(double __x )  __attribute__((__const__)) ;   2825 extern  __attribute__((__nothrow__)) double __ceil(double __x )  __attribute__((__const__)) ;
2826 __inline extern  __attribute__((__nothrow__)) double fabs(double __x )  __attribute__((__const__)) ;   2826 __inline extern  __attribute__((__nothrow__)) double fabs(double __x )  __attribute__((__const__)) ;
2827 extern  __attribute__((__nothrow__)) double __fabs(double __x )  __attribute__((__const__)) ;   2827 extern  __attribute__((__nothrow__)) double __fabs(double __x )  __attribute__((__const__)) ;
2828 __inline extern  __attribute__((__nothrow__)) double floor(double __x )  __attribute__((__const__)) ;   2828 __inline extern  __attribute__((__nothrow__)) double floor(double __x )  __attribute__((__const__)) ;
2829 extern  __attribute__((__nothrow__)) double __floor(double __x )  __attribute__((__const__)) ;   2829 extern  __attribute__((__nothrow__)) double __floor(double __x )  __attribute__((__const__)) ;
2830 extern  __attribute__((__nothrow__)) double fmod(double __x , double __y ) ;   2830 extern  __attribute__((__nothrow__)) double fmod(double __x , double __y ) ;
2831 extern  __attribute__((__nothrow__)) double __fmod(double __x , double __y ) ;   2831 extern  __attribute__((__nothrow__)) double __fmod(double __x , double __y ) ;
2832 extern  __attribute__((__nothrow__)) int __isinf(double __value )  __attribute__((__const__)) ;   2832 extern  __attribute__((__nothrow__)) int __isinf(double __value )  __attribute__((__const__)) ;
2833 __inline extern  __attribute__((__nothrow__)) int __finite(double __x )  __attribute__((__const__)) ;   2833 __inline extern  __attribute__((__nothrow__)) int __finite(double __x )  __attribute__((__const__)) ;
2834 extern  __attribute__((__nothrow__)) int isinf(double __value )  __attribute__((__const__)) ;   2834 extern  __attribute__((__nothrow__)) int isinf(double __value )  __attribute__((__const__)) ;
2835 extern  __attribute__((__nothrow__)) int finite(double __value )  __attribute__((__const__)) ;   2835 extern  __attribute__((__nothrow__)) int finite(double __value )  __attribute__((__const__)) ;
2836 extern  __attribute__((__nothrow__)) double drem(double __x , double __y ) ;   2836 extern  __attribute__((__nothrow__)) double drem(double __x , double __y ) ;
2837 extern  __attribute__((__nothrow__)) double __drem(double __x , double __y ) ;   2837 extern  __attribute__((__nothrow__)) double __drem(double __x , double __y ) ;
2838 extern  __attribute__((__nothrow__)) double significand(double __x ) ;   2838 extern  __attribute__((__nothrow__)) double significand(double __x ) ;
2839 extern  __attribute__((__nothrow__)) double __significand(double __x ) ;   2839 extern  __attribute__((__nothrow__)) double __significand(double __x ) ;
2840 extern  __attribute__((__nothrow__)) double copysign(double __x , double __y )  __attribute__((__const__)) ;   2840 extern  __attribute__((__nothrow__)) double copysign(double __x , double __y )  __attribute__((__const__)) ;
2841 extern  __attribute__((__nothrow__)) double __copysign(double __x , double __y )  __attribute__((__const__)) ;   2841 extern  __attribute__((__nothrow__)) double __copysign(double __x , double __y )  __attribute__((__const__)) ;
2842 extern  __attribute__((__nothrow__)) double nan(char const   *__tagb )  __attribute__((__const__)) ;   2842 extern  __attribute__((__nothrow__)) double nan(char const   *__tagb )  __attribute__((__const__)) ;
2843 extern  __attribute__((__nothrow__)) double __nan(char const   *__tagb )  __attribute__((__const__)) ;   2843 extern  __attribute__((__nothrow__)) double __nan(char const   *__tagb )  __attribute__((__const__)) ;
2844 extern  __attribute__((__nothrow__)) int __isnan(double __value )  __attribute__((__const__)) ;   2844 extern  __attribute__((__nothrow__)) int __isnan(double __value )  __attribute__((__const__)) ;
2845 extern  __attribute__((__nothrow__)) int isnan(double __value )  __attribute__((__const__)) ;   2845 extern  __attribute__((__nothrow__)) int isnan(double __value )  __attribute__((__const__)) ;
2846 extern  __attribute__((__nothrow__)) double j0(double  ) ;   2846 extern  __attribute__((__nothrow__)) double j0(double  ) ;
2847 extern  __attribute__((__nothrow__)) double __j0(double  ) ;   2847 extern  __attribute__((__nothrow__)) double __j0(double  ) ;
2848 extern  __attribute__((__nothrow__)) double j1(double  ) ;   2848 extern  __attribute__((__nothrow__)) double j1(double  ) ;
2849 extern  __attribute__((__nothrow__)) double __j1(double  ) ;   2849 extern  __attribute__((__nothrow__)) double __j1(double  ) ;
2850 extern  __attribute__((__nothrow__)) double jn(int  , double  ) ;   2850 extern  __attribute__((__nothrow__)) double jn(int  , double  ) ;
2851 extern  __attribute__((__nothrow__)) double __jn(int  , double  ) ;   2851 extern  __attribute__((__nothrow__)) double __jn(int  , double  ) ;
2852 extern  __attribute__((__nothrow__)) double y0(double  ) ;   2852 extern  __attribute__((__nothrow__)) double y0(double  ) ;
2853 extern  __attribute__((__nothrow__)) double __y0(double  ) ;   2853 extern  __attribute__((__nothrow__)) double __y0(double  ) ;
2854 extern  __attribute__((__nothrow__)) double y1(double  ) ;   2854 extern  __attribute__((__nothrow__)) double y1(double  ) ;
2855 extern  __attribute__((__nothrow__)) double __y1(double  ) ;   2855 extern  __attribute__((__nothrow__)) double __y1(double  ) ;
2856 extern  __attribute__((__nothrow__)) double yn(int  , double  ) ;   2856 extern  __attribute__((__nothrow__)) double yn(int  , double  ) ;
2857 extern  __attribute__((__nothrow__)) double __yn(int  , double  ) ;   2857 extern  __attribute__((__nothrow__)) double __yn(int  , double  ) ;
2858 extern  __attribute__((__nothrow__)) double erf(double  ) ;   2858 extern  __attribute__((__nothrow__)) double erf(double  ) ;
2859 extern  __attribute__((__nothrow__)) double __erf(double  ) ;   2859 extern  __attribute__((__nothrow__)) double __erf(double  ) ;
2860 extern  __attribute__((__nothrow__)) double erfc(double  ) ;   2860 extern  __attribute__((__nothrow__)) double erfc(double  ) ;
2861 extern  __attribute__((__nothrow__)) double __erfc(double  ) ;   2861 extern  __attribute__((__nothrow__)) double __erfc(double  ) ;
2862 extern  __attribute__((__nothrow__)) double lgamma(double  ) ;   2862 extern  __attribute__((__nothrow__)) double lgamma(double  ) ;
2863 extern  __attribute__((__nothrow__)) double __lgamma(double  ) ;   2863 extern  __attribute__((__nothrow__)) double __lgamma(double  ) ;
2864 extern  __attribute__((__nothrow__)) double tgamma(double  ) ;   2864 extern  __attribute__((__nothrow__)) double tgamma(double  ) ;
2865 extern  __attribute__((__nothrow__)) double __tgamma(double  ) ;   2865 extern  __attribute__((__nothrow__)) double __tgamma(double  ) ;
2866 extern  __attribute__((__nothrow__)) double gamma(double  ) ;   2866 extern  __attribute__((__nothrow__)) double gamma(double  ) ;
2867 extern  __attribute__((__nothrow__)) double __gamma(double  ) ;   2867 extern  __attribute__((__nothrow__)) double __gamma(double  ) ;
2868 extern  __attribute__((__nothrow__)) double lgamma_r(double  , int *__signgamp ) ;   2868 extern  __attribute__((__nothrow__)) double lgamma_r(double  , int *__signgamp ) ;
2869 extern  __attribute__((__nothrow__)) double __lgamma_r(double  ,   2869 extern  __attribute__((__nothrow__)) double __lgamma_r(double  ,
2870                                                        int *__signgamp ) ;   2870                                                        int *__signgamp ) ;
2871 extern  __attribute__((__nothrow__)) double rint(double __x ) ;   2871 extern  __attribute__((__nothrow__)) double rint(double __x ) ;
2872 extern  __attribute__((__nothrow__)) double __rint(double __x ) ;   2872 extern  __attribute__((__nothrow__)) double __rint(double __x ) ;
2873 extern  __attribute__((__nothrow__)) double nextafter(double __x , double __y )  __attribute__((__const__)) ;   2873 extern  __attribute__((__nothrow__)) double nextafter(double __x , double __y )  __attribute__((__const__)) ;
2874 extern  __attribute__((__nothrow__)) double __nextafter(double __x , double __y )  __attribute__((__const__)) ;   2874 extern  __attribute__((__nothrow__)) double __nextafter(double __x , double __y )  __attribute__((__const__)) ;
2875 extern  __attribute__((__nothrow__)) double nexttoward(double __x ,   2875 extern  __attribute__((__nothrow__)) double nexttoward(double __x ,
2876                                                        long double __y )  __attribute__((__const__)) ;   2876                                                        long double __y )  __attribute__((__const__)) ;
2877 extern  __attribute__((__nothrow__)) double __nexttoward(double __x ,   2877 extern  __attribute__((__nothrow__)) double __nexttoward(double __x ,
2878                                                          long double __y )  __attribute__((__const__)) ;   2878                                                          long double __y )  __attribute__((__const__)) ;
2879 extern  __attribute__((__nothrow__)) double remainder(double __x , double __y ) ;   2879 extern  __attribute__((__nothrow__)) double remainder(double __x , double __y ) ;
2880 extern  __attribute__((__nothrow__)) double __remainder(double __x , double __y ) ;   2880 extern  __attribute__((__nothrow__)) double __remainder(double __x , double __y ) ;
2881 extern  __attribute__((__nothrow__)) double scalbn(double __x , int __n ) ;   2881 extern  __attribute__((__nothrow__)) double scalbn(double __x , int __n ) ;
2882 extern  __attribute__((__nothrow__)) double __scalbn(double __x , int __n ) ;   2882 extern  __attribute__((__nothrow__)) double __scalbn(double __x , int __n ) ;
2883 extern  __attribute__((__nothrow__)) int ilogb(double __x ) ;   2883 extern  __attribute__((__nothrow__)) int ilogb(double __x ) ;
2884 extern  __attribute__((__nothrow__)) int __ilogb(double __x ) ;   2884 extern  __attribute__((__nothrow__)) int __ilogb(double __x ) ;
2885 extern  __attribute__((__nothrow__)) double scalbln(double __x , long __n ) ;   2885 extern  __attribute__((__nothrow__)) double scalbln(double __x , long __n ) ;
2886 extern  __attribute__((__nothrow__)) double __scalbln(double __x , long __n ) ;   2886 extern  __attribute__((__nothrow__)) double __scalbln(double __x , long __n ) ;
2887 extern  __attribute__((__nothrow__)) double nearbyint(double __x ) ;   2887 extern  __attribute__((__nothrow__)) double nearbyint(double __x ) ;
2888 extern  __attribute__((__nothrow__)) double __nearbyint(double __x ) ;   2888 extern  __attribute__((__nothrow__)) double __nearbyint(double __x ) ;
2889 extern  __attribute__((__nothrow__)) double round(double __x )  __attribute__((__const__)) ;   2889 extern  __attribute__((__nothrow__)) double round(double __x )  __attribute__((__const__)) ;
2890 extern  __attribute__((__nothrow__)) double __round(double __x )  __attribute__((__const__)) ;   2890 extern  __attribute__((__nothrow__)) double __round(double __x )  __attribute__((__const__)) ;
2891 extern  __attribute__((__nothrow__)) double trunc(double __x )  __attribute__((__const__)) ;   2891 extern  __attribute__((__nothrow__)) double trunc(double __x )  __attribute__((__const__)) ;
2892 extern  __attribute__((__nothrow__)) double __trunc(double __x )  __attribute__((__const__)) ;   2892 extern  __attribute__((__nothrow__)) double __trunc(double __x )  __attribute__((__const__)) ;
2893 extern  __attribute__((__nothrow__)) double remquo(double __x , double __y ,   2893 extern  __attribute__((__nothrow__)) double remquo(double __x , double __y ,
2894                                                    int *__quo ) ;   2894                                                    int *__quo ) ;
2895 extern  __attribute__((__nothrow__)) double __remquo(double __x , double __y ,   2895 extern  __attribute__((__nothrow__)) double __remquo(double __x , double __y ,
2896                                                      int *__quo ) ;   2896                                                      int *__quo ) ;
2897 __inline extern  __attribute__((__nothrow__)) long lrint(double __x ) ;   2897 __inline extern  __attribute__((__nothrow__)) long lrint(double __x ) ;
2898 extern  __attribute__((__nothrow__)) long __lrint(double __x ) ;   2898 extern  __attribute__((__nothrow__)) long __lrint(double __x ) ;
2899 __inline extern  __attribute__((__nothrow__)) long long llrint(double __x ) ;   2899 __inline extern  __attribute__((__nothrow__)) long long llrint(double __x ) ;
2900 extern  __attribute__((__nothrow__)) long long __llrint(double __x ) ;   2900 extern  __attribute__((__nothrow__)) long long __llrint(double __x ) ;
2901 extern  __attribute__((__nothrow__)) long lround(double __x ) ;   2901 extern  __attribute__((__nothrow__)) long lround(double __x ) ;
2902 extern  __attribute__((__nothrow__)) long __lround(double __x ) ;   2902 extern  __attribute__((__nothrow__)) long __lround(double __x ) ;
2903 extern  __attribute__((__nothrow__)) long long llround(double __x ) ;   2903 extern  __attribute__((__nothrow__)) long long llround(double __x ) ;
2904 extern  __attribute__((__nothrow__)) long long __llround(double __x ) ;   2904 extern  __attribute__((__nothrow__)) long long __llround(double __x ) ;
2905 extern  __attribute__((__nothrow__)) double fdim(double __x , double __y ) ;   2905 extern  __attribute__((__nothrow__)) double fdim(double __x , double __y ) ;
2906 extern  __attribute__((__nothrow__)) double __fdim(double __x , double __y ) ;   2906 extern  __attribute__((__nothrow__)) double __fdim(double __x , double __y ) ;
2907 extern  __attribute__((__nothrow__)) double fmax(double __x , double __y ) ;   2907 extern  __attribute__((__nothrow__)) double fmax(double __x , double __y ) ;
2908 extern  __attribute__((__nothrow__)) double __fmax(double __x , double __y ) ;   2908 extern  __attribute__((__nothrow__)) double __fmax(double __x , double __y ) ;
2909 extern  __attribute__((__nothrow__)) double fmin(double __x , double __y ) ;   2909 extern  __attribute__((__nothrow__)) double fmin(double __x , double __y ) ;
2910 extern  __attribute__((__nothrow__)) double __fmin(double __x , double __y ) ;   2910 extern  __attribute__((__nothrow__)) double __fmin(double __x , double __y ) ;
2911 extern  __attribute__((__nothrow__)) int __fpclassify(double __value )  __attribute__((__const__)) ;   2911 extern  __attribute__((__nothrow__)) int __fpclassify(double __value )  __attribute__((__const__)) ;
2912 __inline extern  __attribute__((__nothrow__)) int __signbit(double __x )  __attribute__((__const__)) ;   2912 __inline extern  __attribute__((__nothrow__)) int __signbit(double __x )  __attribute__((__const__)) ;
2913 extern  __attribute__((__nothrow__)) double fma(double __x , double __y ,   2913 extern  __attribute__((__nothrow__)) double fma(double __x , double __y ,
2914                                                 double __z ) ;   2914                                                 double __z ) ;
2915 extern  __attribute__((__nothrow__)) double __fma(double __x , double __y ,   2915 extern  __attribute__((__nothrow__)) double __fma(double __x , double __y ,
2916                                                   double __z ) ;   2916                                                   double __z ) ;
2917 extern  __attribute__((__nothrow__)) double scalb(double __x , double __n ) ;   2917 extern  __attribute__((__nothrow__)) double scalb(double __x , double __n ) ;
2918 extern  __attribute__((__nothrow__)) double __scalb(double __x , double __n ) ;   2918 extern  __attribute__((__nothrow__)) double __scalb(double __x , double __n ) ;
2919 extern  __attribute__((__nothrow__)) float acosf(float __x ) ;   2919 extern  __attribute__((__nothrow__)) float acosf(float __x ) ;
2920 extern  __attribute__((__nothrow__)) float __acosf(float __x ) ;   2920 extern  __attribute__((__nothrow__)) float __acosf(float __x ) ;
2921 extern  __attribute__((__nothrow__)) float asinf(float __x ) ;   2921 extern  __attribute__((__nothrow__)) float asinf(float __x ) ;
2922 extern  __attribute__((__nothrow__)) float __asinf(float __x ) ;   2922 extern  __attribute__((__nothrow__)) float __asinf(float __x ) ;
2923 extern  __attribute__((__nothrow__)) float atanf(float __x ) ;   2923 extern  __attribute__((__nothrow__)) float atanf(float __x ) ;
2924 extern  __attribute__((__nothrow__)) float __atanf(float __x ) ;   2924 extern  __attribute__((__nothrow__)) float __atanf(float __x ) ;
2925 extern  __attribute__((__nothrow__)) float atan2f(float __y , float __x ) ;   2925 extern  __attribute__((__nothrow__)) float atan2f(float __y , float __x ) ;
2926 extern  __attribute__((__nothrow__)) float __atan2f(float __y , float __x ) ;   2926 extern  __attribute__((__nothrow__)) float __atan2f(float __y , float __x ) ;
2927 extern  __attribute__((__nothrow__)) float cosf(float __x ) ;   2927 extern  __attribute__((__nothrow__)) float cosf(float __x ) ;
2928 extern  __attribute__((__nothrow__)) float __cosf(float __x ) ;   2928 extern  __attribute__((__nothrow__)) float __cosf(float __x ) ;
2929 extern  __attribute__((__nothrow__)) float sinf(float __x ) ;   2929 extern  __attribute__((__nothrow__)) float sinf(float __x ) ;
2930 extern  __attribute__((__nothrow__)) float __sinf(float __x ) ;   2930 extern  __attribute__((__nothrow__)) float __sinf(float __x ) ;
2931 extern  __attribute__((__nothrow__)) float tanf(float __x ) ;   2931 extern  __attribute__((__nothrow__)) float tanf(float __x ) ;
2932 extern  __attribute__((__nothrow__)) float __tanf(float __x ) ;   2932 extern  __attribute__((__nothrow__)) float __tanf(float __x ) ;
2933 extern  __attribute__((__nothrow__)) float coshf(float __x ) ;   2933 extern  __attribute__((__nothrow__)) float coshf(float __x ) ;
2934 extern  __attribute__((__nothrow__)) float __coshf(float __x ) ;   2934 extern  __attribute__((__nothrow__)) float __coshf(float __x ) ;
2935 extern  __attribute__((__nothrow__)) float sinhf(float __x ) ;   2935 extern  __attribute__((__nothrow__)) float sinhf(float __x ) ;
2936 extern  __attribute__((__nothrow__)) float __sinhf(float __x ) ;   2936 extern  __attribute__((__nothrow__)) float __sinhf(float __x ) ;
2937 extern  __attribute__((__nothrow__)) float tanhf(float __x ) ;   2937 extern  __attribute__((__nothrow__)) float tanhf(float __x ) ;
2938 extern  __attribute__((__nothrow__)) float __tanhf(float __x ) ;   2938 extern  __attribute__((__nothrow__)) float __tanhf(float __x ) ;
2939 extern  __attribute__((__nothrow__)) float acoshf(float __x ) ;   2939 extern  __attribute__((__nothrow__)) float acoshf(float __x ) ;
2940 extern  __attribute__((__nothrow__)) float __acoshf(float __x ) ;   2940 extern  __attribute__((__nothrow__)) float __acoshf(float __x ) ;
2941 extern  __attribute__((__nothrow__)) float asinhf(float __x ) ;   2941 extern  __attribute__((__nothrow__)) float asinhf(float __x ) ;
2942 extern  __attribute__((__nothrow__)) float __asinhf(float __x ) ;   2942 extern  __attribute__((__nothrow__)) float __asinhf(float __x ) ;
2943 extern  __attribute__((__nothrow__)) float atanhf(float __x ) ;   2943 extern  __attribute__((__nothrow__)) float atanhf(float __x ) ;
2944 extern  __attribute__((__nothrow__)) float __atanhf(float __x ) ;   2944 extern  __attribute__((__nothrow__)) float __atanhf(float __x ) ;
2945 extern  __attribute__((__nothrow__)) float expf(float __x ) ;   2945 extern  __attribute__((__nothrow__)) float expf(float __x ) ;
2946 extern  __attribute__((__nothrow__)) float __expf(float __x ) ;   2946 extern  __attribute__((__nothrow__)) float __expf(float __x ) ;
2947 extern  __attribute__((__nothrow__)) float frexpf(float __x , int *__exponent ) ;   2947 extern  __attribute__((__nothrow__)) float frexpf(float __x , int *__exponent ) ;
2948 extern  __attribute__((__nothrow__)) float __frexpf(float __x , int *__exponent ) ;   2948 extern  __attribute__((__nothrow__)) float __frexpf(float __x , int *__exponent ) ;
2949 extern  __attribute__((__nothrow__)) float ldexpf(float __x , int __exponent ) ;   2949 extern  __attribute__((__nothrow__)) float ldexpf(float __x , int __exponent ) ;
2950 extern  __attribute__((__nothrow__)) float __ldexpf(float __x , int __exponent ) ;   2950 extern  __attribute__((__nothrow__)) float __ldexpf(float __x , int __exponent ) ;
2951 extern  __attribute__((__nothrow__)) float logf(float __x ) ;   2951 extern  __attribute__((__nothrow__)) float logf(float __x ) ;
2952 extern  __attribute__((__nothrow__)) float __logf(float __x ) ;   2952 extern  __attribute__((__nothrow__)) float __logf(float __x ) ;
2953 extern  __attribute__((__nothrow__)) float log10f(float __x ) ;   2953 extern  __attribute__((__nothrow__)) float log10f(float __x ) ;
2954 extern  __attribute__((__nothrow__)) float __log10f(float __x ) ;   2954 extern  __attribute__((__nothrow__)) float __log10f(float __x ) ;
2955 extern  __attribute__((__nothrow__)) float modff(float __x , float *__iptr ) ;   2955 extern  __attribute__((__nothrow__)) float modff(float __x , float *__iptr ) ;
2956 extern  __attribute__((__nothrow__)) float __modff(float __x , float *__iptr ) ;   2956 extern  __attribute__((__nothrow__)) float __modff(float __x , float *__iptr ) ;
2957 extern  __attribute__((__nothrow__)) float expm1f(float __x ) ;   2957 extern  __attribute__((__nothrow__)) float expm1f(float __x ) ;
2958 extern  __attribute__((__nothrow__)) float __expm1f(float __x ) ;   2958 extern  __attribute__((__nothrow__)) float __expm1f(float __x ) ;
2959 extern  __attribute__((__nothrow__)) float log1pf(float __x ) ;   2959 extern  __attribute__((__nothrow__)) float log1pf(float __x ) ;
2960 extern  __attribute__((__nothrow__)) float __log1pf(float __x ) ;   2960 extern  __attribute__((__nothrow__)) float __log1pf(float __x ) ;
2961 extern  __attribute__((__nothrow__)) float logbf(float __x ) ;   2961 extern  __attribute__((__nothrow__)) float logbf(float __x ) ;
2962 extern  __attribute__((__nothrow__)) float __logbf(float __x ) ;   2962 extern  __attribute__((__nothrow__)) float __logbf(float __x ) ;
2963 extern  __attribute__((__nothrow__)) float exp2f(float __x ) ;   2963 extern  __attribute__((__nothrow__)) float exp2f(float __x ) ;
2964 extern  __attribute__((__nothrow__)) float __exp2f(float __x ) ;   2964 extern  __attribute__((__nothrow__)) float __exp2f(float __x ) ;
2965 extern  __attribute__((__nothrow__)) float log2f(float __x ) ;   2965 extern  __attribute__((__nothrow__)) float log2f(float __x ) ;
2966 extern  __attribute__((__nothrow__)) float __log2f(float __x ) ;   2966 extern  __attribute__((__nothrow__)) float __log2f(float __x ) ;
2967 extern  __attribute__((__nothrow__)) float powf(float __x , float __y ) ;   2967 extern  __attribute__((__nothrow__)) float powf(float __x , float __y ) ;
2968 extern  __attribute__((__nothrow__)) float __powf(float __x , float __y ) ;   2968 extern  __attribute__((__nothrow__)) float __powf(float __x , float __y ) ;
2969 extern  __attribute__((__nothrow__)) float sqrtf(float __x ) ;   2969 extern  __attribute__((__nothrow__)) float sqrtf(float __x ) ;
2970 extern  __attribute__((__nothrow__)) float __sqrtf(float __x ) ;   2970 extern  __attribute__((__nothrow__)) float __sqrtf(float __x ) ;
2971 extern  __attribute__((__nothrow__)) float hypotf(float __x , float __y ) ;   2971 extern  __attribute__((__nothrow__)) float hypotf(float __x , float __y ) ;
2972 extern  __attribute__((__nothrow__)) float __hypotf(float __x , float __y ) ;   2972 extern  __attribute__((__nothrow__)) float __hypotf(float __x , float __y ) ;
2973 extern  __attribute__((__nothrow__)) float cbrtf(float __x ) ;   2973 extern  __attribute__((__nothrow__)) float cbrtf(float __x ) ;
2974 extern  __attribute__((__nothrow__)) float __cbrtf(float __x ) ;   2974 extern  __attribute__((__nothrow__)) float __cbrtf(float __x ) ;
2975 __inline extern  __attribute__((__nothrow__)) float ceilf(float __x )  __attribute__((__const__)) ;   2975 __inline extern  __attribute__((__nothrow__)) float ceilf(float __x )  __attribute__((__const__)) ;
2976 extern  __attribute__((__nothrow__)) float __ceilf(float __x )  __attribute__((__const__)) ;   2976 extern  __attribute__((__nothrow__)) float __ceilf(float __x )  __attribute__((__const__)) ;
2977 __inline extern  __attribute__((__nothrow__)) float fabsf(float __x )  __attribute__((__const__)) ;   2977 __inline extern  __attribute__((__nothrow__)) float fabsf(float __x )  __attribute__((__const__)) ;
2978 extern  __attribute__((__nothrow__)) float __fabsf(float __x )  __attribute__((__const__)) ;   2978 extern  __attribute__((__nothrow__)) float __fabsf(float __x )  __attribute__((__const__)) ;
2979 __inline extern  __attribute__((__nothrow__)) float floorf(float __x )  __attribute__((__const__)) ;   2979 __inline extern  __attribute__((__nothrow__)) float floorf(float __x )  __attribute__((__const__)) ;
2980 extern  __attribute__((__nothrow__)) float __floorf(float __x )  __attribute__((__const__)) ;   2980 extern  __attribute__((__nothrow__)) float __floorf(float __x )  __attribute__((__const__)) ;
2981 extern  __attribute__((__nothrow__)) float fmodf(float __x , float __y ) ;   2981 extern  __attribute__((__nothrow__)) float fmodf(float __x , float __y ) ;
2982 extern  __attribute__((__nothrow__)) float __fmodf(float __x , float __y ) ;   2982 extern  __attribute__((__nothrow__)) float __fmodf(float __x , float __y ) ;
2983 extern  __attribute__((__nothrow__)) int __isinff(float __value )  __attribute__((__const__)) ;   2983 extern  __attribute__((__nothrow__)) int __isinff(float __value )  __attribute__((__const__)) ;
2984 extern  __attribute__((__nothrow__)) int __finitef(float __value )  __attribute__((__const__)) ;   2984 extern  __attribute__((__nothrow__)) int __finitef(float __value )  __attribute__((__const__)) ;
2985 extern  __attribute__((__nothrow__)) int isinff(float __value )  __attribute__((__const__)) ;   2985 extern  __attribute__((__nothrow__)) int isinff(float __value )  __attribute__((__const__)) ;
2986 extern  __attribute__((__nothrow__)) int finitef(float __value )  __attribute__((__const__)) ;   2986 extern  __attribute__((__nothrow__)) int finitef(float __value )  __attribute__((__const__)) ;
2987 extern  __attribute__((__nothrow__)) float dremf(float __x , float __y ) ;   2987 extern  __attribute__((__nothrow__)) float dremf(float __x , float __y ) ;
2988 extern  __attribute__((__nothrow__)) float __dremf(float __x , float __y ) ;   2988 extern  __attribute__((__nothrow__)) float __dremf(float __x , float __y ) ;
2989 extern  __attribute__((__nothrow__)) float significandf(float __x ) ;   2989 extern  __attribute__((__nothrow__)) float significandf(float __x ) ;
2990 extern  __attribute__((__nothrow__)) float __significandf(float __x ) ;   2990 extern  __attribute__((__nothrow__)) float __significandf(float __x ) ;
2991 extern  __attribute__((__nothrow__)) float copysignf(float __x , float __y )  __attribute__((__const__)) ;   2991 extern  __attribute__((__nothrow__)) float copysignf(float __x , float __y )  __attribute__((__const__)) ;
2992 extern  __attribute__((__nothrow__)) float __copysignf(float __x , float __y )  __attribute__((__const__)) ;   2992 extern  __attribute__((__nothrow__)) float __copysignf(float __x , float __y )  __attribute__((__const__)) ;
2993 extern  __attribute__((__nothrow__)) float nanf(char const   *__tagb )  __attribute__((__const__)) ;   2993 extern  __attribute__((__nothrow__)) float nanf(char const   *__tagb )  __attribute__((__const__)) ;
2994 extern  __attribute__((__nothrow__)) float __nanf(char const   *__tagb )  __attribute__((__const__)) ;   2994 extern  __attribute__((__nothrow__)) float __nanf(char const   *__tagb )  __attribute__((__const__)) ;
2995 extern  __attribute__((__nothrow__)) int __isnanf(float __value )  __attribute__((__const__)) ;   2995 extern  __attribute__((__nothrow__)) int __isnanf(float __value )  __attribute__((__const__)) ;
2996 extern  __attribute__((__nothrow__)) int isnanf(float __value )  __attribute__((__const__)) ;   2996 extern  __attribute__((__nothrow__)) int isnanf(float __value )  __attribute__((__const__)) ;
2997 extern  __attribute__((__nothrow__)) float j0f(float  ) ;   2997 extern  __attribute__((__nothrow__)) float j0f(float  ) ;
2998 extern  __attribute__((__nothrow__)) float __j0f(float  ) ;   2998 extern  __attribute__((__nothrow__)) float __j0f(float  ) ;
2999 extern  __attribute__((__nothrow__)) float j1f(float  ) ;   2999 extern  __attribute__((__nothrow__)) float j1f(float  ) ;
3000 extern  __attribute__((__nothrow__)) float __j1f(float  ) ;   3000 extern  __attribute__((__nothrow__)) float __j1f(float  ) ;
3001 extern  __attribute__((__nothrow__)) float jnf(int  , float  ) ;   3001 extern  __attribute__((__nothrow__)) float jnf(int  , float  ) ;
3002 extern  __attribute__((__nothrow__)) float __jnf(int  , float  ) ;   3002 extern  __attribute__((__nothrow__)) float __jnf(int  , float  ) ;
3003 extern  __attribute__((__nothrow__)) float y0f(float  ) ;   3003 extern  __attribute__((__nothrow__)) float y0f(float  ) ;
3004 extern  __attribute__((__nothrow__)) float __y0f(float  ) ;   3004 extern  __attribute__((__nothrow__)) float __y0f(float  ) ;
3005 extern  __attribute__((__nothrow__)) float y1f(float  ) ;   3005 extern  __attribute__((__nothrow__)) float y1f(float  ) ;
3006 extern  __attribute__((__nothrow__)) float __y1f(float  ) ;   3006 extern  __attribute__((__nothrow__)) float __y1f(float  ) ;
3007 extern  __attribute__((__nothrow__)) float ynf(int  , float  ) ;   3007 extern  __attribute__((__nothrow__)) float ynf(int  , float  ) ;
3008 extern  __attribute__((__nothrow__)) float __ynf(int  , float  ) ;   3008 extern  __attribute__((__nothrow__)) float __ynf(int  , float  ) ;
3009 extern  __attribute__((__nothrow__)) float erff(float  ) ;   3009 extern  __attribute__((__nothrow__)) float erff(float  ) ;
3010 extern  __attribute__((__nothrow__)) float __erff(float  ) ;   3010 extern  __attribute__((__nothrow__)) float __erff(float  ) ;
3011 extern  __attribute__((__nothrow__)) float erfcf(float  ) ;   3011 extern  __attribute__((__nothrow__)) float erfcf(float  ) ;
3012 extern  __attribute__((__nothrow__)) float __erfcf(float  ) ;   3012 extern  __attribute__((__nothrow__)) float __erfcf(float  ) ;
3013 extern  __attribute__((__nothrow__)) float lgammaf(float  ) ;   3013 extern  __attribute__((__nothrow__)) float lgammaf(float  ) ;
3014 extern  __attribute__((__nothrow__)) float __lgammaf(float  ) ;   3014 extern  __attribute__((__nothrow__)) float __lgammaf(float  ) ;
3015 extern  __attribute__((__nothrow__)) float tgammaf(float  ) ;   3015 extern  __attribute__((__nothrow__)) float tgammaf(float  ) ;
3016 extern  __attribute__((__nothrow__)) float __tgammaf(float  ) ;   3016 extern  __attribute__((__nothrow__)) float __tgammaf(float  ) ;
3017 extern  __attribute__((__nothrow__)) float gammaf(float  ) ;   3017 extern  __attribute__((__nothrow__)) float gammaf(float  ) ;
3018 extern  __attribute__((__nothrow__)) float __gammaf(float  ) ;   3018 extern  __attribute__((__nothrow__)) float __gammaf(float  ) ;
3019 extern  __attribute__((__nothrow__)) float lgammaf_r(float  , int *__signgamp ) ;   3019 extern  __attribute__((__nothrow__)) float lgammaf_r(float  , int *__signgamp ) ;
3020 extern  __attribute__((__nothrow__)) float __lgammaf_r(float  , int *__signgamp ) ;   3020 extern  __attribute__((__nothrow__)) float __lgammaf_r(float  , int *__signgamp ) ;
3021 extern  __attribute__((__nothrow__)) float rintf(float __x ) ;   3021 extern  __attribute__((__nothrow__)) float rintf(float __x ) ;
3022 extern  __attribute__((__nothrow__)) float __rintf(float __x ) ;   3022 extern  __attribute__((__nothrow__)) float __rintf(float __x ) ;
3023 extern  __attribute__((__nothrow__)) float nextafterf(float __x , float __y )  __attribute__((__const__)) ;   3023 extern  __attribute__((__nothrow__)) float nextafterf(float __x , float __y )  __attribute__((__const__)) ;
3024 extern  __attribute__((__nothrow__)) float __nextafterf(float __x , float __y )  __attribute__((__const__)) ;   3024 extern  __attribute__((__nothrow__)) float __nextafterf(float __x , float __y )  __attribute__((__const__)) ;
3025 extern  __attribute__((__nothrow__)) float nexttowardf(float __x ,   3025 extern  __attribute__((__nothrow__)) float nexttowardf(float __x ,
3026                                                        long double __y )  __attribute__((__const__)) ;   3026                                                        long double __y )  __attribute__((__const__)) ;
3027 extern  __attribute__((__nothrow__)) float __nexttowardf(float __x ,   3027 extern  __attribute__((__nothrow__)) float __nexttowardf(float __x ,
3028                                                          long double __y )  __attribute__((__const__)) ;   3028                                                          long double __y )  __attribute__((__const__)) ;
3029 extern  __attribute__((__nothrow__)) float remainderf(float __x , float __y ) ;   3029 extern  __attribute__((__nothrow__)) float remainderf(float __x , float __y ) ;
3030 extern  __attribute__((__nothrow__)) float __remainderf(float __x , float __y ) ;   3030 extern  __attribute__((__nothrow__)) float __remainderf(float __x , float __y ) ;
3031 extern  __attribute__((__nothrow__)) float scalbnf(float __x , int __n ) ;   3031 extern  __attribute__((__nothrow__)) float scalbnf(float __x , int __n ) ;
3032 extern  __attribute__((__nothrow__)) float __scalbnf(float __x , int __n ) ;   3032 extern  __attribute__((__nothrow__)) float __scalbnf(float __x , int __n ) ;
3033 extern  __attribute__((__nothrow__)) int ilogbf(float __x ) ;   3033 extern  __attribute__((__nothrow__)) int ilogbf(float __x ) ;
3034 extern  __attribute__((__nothrow__)) int __ilogbf(float __x ) ;   3034 extern  __attribute__((__nothrow__)) int __ilogbf(float __x ) ;
3035 extern  __attribute__((__nothrow__)) float scalblnf(float __x , long __n ) ;   3035 extern  __attribute__((__nothrow__)) float scalblnf(float __x , long __n ) ;
3036 extern  __attribute__((__nothrow__)) float __scalblnf(float __x , long __n ) ;   3036 extern  __attribute__((__nothrow__)) float __scalblnf(float __x , long __n ) ;
3037 extern  __attribute__((__nothrow__)) float nearbyintf(float __x ) ;   3037 extern  __attribute__((__nothrow__)) float nearbyintf(float __x ) ;
3038 extern  __attribute__((__nothrow__)) float __nearbyintf(float __x ) ;   3038 extern  __attribute__((__nothrow__)) float __nearbyintf(float __x ) ;
3039 extern  __attribute__((__nothrow__)) float roundf(float __x )  __attribute__((__const__)) ;   3039 extern  __attribute__((__nothrow__)) float roundf(float __x )  __attribute__((__const__)) ;
3040 extern  __attribute__((__nothrow__)) float __roundf(float __x )  __attribute__((__const__)) ;   3040 extern  __attribute__((__nothrow__)) float __roundf(float __x )  __attribute__((__const__)) ;
3041 extern  __attribute__((__nothrow__)) float truncf(float __x )  __attribute__((__const__)) ;   3041 extern  __attribute__((__nothrow__)) float truncf(float __x )  __attribute__((__const__)) ;
3042 extern  __attribute__((__nothrow__)) float __truncf(float __x )  __attribute__((__const__)) ;   3042 extern  __attribute__((__nothrow__)) float __truncf(float __x )  __attribute__((__const__)) ;
3043 extern  __attribute__((__nothrow__)) float remquof(float __x , float __y ,   3043 extern  __attribute__((__nothrow__)) float remquof(float __x , float __y ,
3044                                                    int *__quo ) ;   3044                                                    int *__quo ) ;
3045 extern  __attribute__((__nothrow__)) float __remquof(float __x , float __y ,   3045 extern  __attribute__((__nothrow__)) float __remquof(float __x , float __y ,
3046                                                      int *__quo ) ;   3046                                                      int *__quo ) ;
3047 __inline extern  __attribute__((__nothrow__)) long lrintf(float __x ) ;   3047 __inline extern  __attribute__((__nothrow__)) long lrintf(float __x ) ;
3048 extern  __attribute__((__nothrow__)) long __lrintf(float __x ) ;   3048 extern  __attribute__((__nothrow__)) long __lrintf(float __x ) ;
3049 __inline extern  __attribute__((__nothrow__)) long long llrintf(float __x ) ;   3049 __inline extern  __attribute__((__nothrow__)) long long llrintf(float __x ) ;
3050 extern  __attribute__((__nothrow__)) long long __llrintf(float __x ) ;   3050 extern  __attribute__((__nothrow__)) long long __llrintf(float __x ) ;
3051 extern  __attribute__((__nothrow__)) long lroundf(float __x ) ;   3051 extern  __attribute__((__nothrow__)) long lroundf(float __x ) ;
3052 extern  __attribute__((__nothrow__)) long __lroundf(float __x ) ;   3052 extern  __attribute__((__nothrow__)) long __lroundf(float __x ) ;
3053 extern  __attribute__((__nothrow__)) long long llroundf(float __x ) ;   3053 extern  __attribute__((__nothrow__)) long long llroundf(float __x ) ;
3054 extern  __attribute__((__nothrow__)) long long __llroundf(float __x ) ;   3054 extern  __attribute__((__nothrow__)) long long __llroundf(float __x ) ;
3055 extern  __attribute__((__nothrow__)) float fdimf(float __x , float __y ) ;   3055 extern  __attribute__((__nothrow__)) float fdimf(float __x , float __y ) ;
3056 extern  __attribute__((__nothrow__)) float __fdimf(float __x , float __y ) ;   3056 extern  __attribute__((__nothrow__)) float __fdimf(float __x , float __y ) ;
3057 extern  __attribute__((__nothrow__)) float fmaxf(float __x , float __y ) ;   3057 extern  __attribute__((__nothrow__)) float fmaxf(float __x , float __y ) ;
3058 extern  __attribute__((__nothrow__)) float __fmaxf(float __x , float __y ) ;   3058 extern  __attribute__((__nothrow__)) float __fmaxf(float __x , float __y ) ;
3059 extern  __attribute__((__nothrow__)) float fminf(float __x , float __y ) ;   3059 extern  __attribute__((__nothrow__)) float fminf(float __x , float __y ) ;
3060 extern  __attribute__((__nothrow__)) float __fminf(float __x , float __y ) ;   3060 extern  __attribute__((__nothrow__)) float __fminf(float __x , float __y ) ;
3061 extern  __attribute__((__nothrow__)) int __fpclassifyf(float __value )  __attribute__((__const__)) ;   3061 extern  __attribute__((__nothrow__)) int __fpclassifyf(float __value )  __attribute__((__const__)) ;
3062 __inline extern  __attribute__((__nothrow__)) int __signbitf(float __x )  __attribute__((__const__)) ;   3062 __inline extern  __attribute__((__nothrow__)) int __signbitf(float __x )  __attribute__((__const__)) ;
3063 extern  __attribute__((__nothrow__)) float fmaf(float __x , float __y ,   3063 extern  __attribute__((__nothrow__)) float fmaf(float __x , float __y ,
3064                                                 float __z ) ;   3064                                                 float __z ) ;
3065 extern  __attribute__((__nothrow__)) float __fmaf(float __x , float __y ,   3065 extern  __attribute__((__nothrow__)) float __fmaf(float __x , float __y ,
3066                                                   float __z ) ;   3066                                                   float __z ) ;
3067 extern  __attribute__((__nothrow__)) float scalbf(float __x , float __n ) ;   3067 extern  __attribute__((__nothrow__)) float scalbf(float __x , float __n ) ;
3068 extern  __attribute__((__nothrow__)) float __scalbf(float __x , float __n ) ;   3068 extern  __attribute__((__nothrow__)) float __scalbf(float __x , float __n ) ;
3069 extern  __attribute__((__nothrow__)) long double acosl(long double __x ) ;   3069 extern  __attribute__((__nothrow__)) long double acosl(long double __x ) ;
3070 extern  __attribute__((__nothrow__)) long double __acosl(long double __x ) ;   3070 extern  __attribute__((__nothrow__)) long double __acosl(long double __x ) ;
3071 extern  __attribute__((__nothrow__)) long double asinl(long double __x ) ;   3071 extern  __attribute__((__nothrow__)) long double asinl(long double __x ) ;
3072 extern  __attribute__((__nothrow__)) long double __asinl(long double __x ) ;   3072 extern  __attribute__((__nothrow__)) long double __asinl(long double __x ) ;
3073 extern  __attribute__((__nothrow__)) long double atanl(long double __x ) ;   3073 extern  __attribute__((__nothrow__)) long double atanl(long double __x ) ;
3074 extern  __attribute__((__nothrow__)) long double __atanl(long double __x ) ;   3074 extern  __attribute__((__nothrow__)) long double __atanl(long double __x ) ;
3075 extern  __attribute__((__nothrow__)) long double atan2l(long double __y ,   3075 extern  __attribute__((__nothrow__)) long double atan2l(long double __y ,
3076                                                         long double __x ) ;   3076                                                         long double __x ) ;
3077 __inline extern  __attribute__((__nothrow__)) long double __atan2l(long double __y ,   3077 __inline extern  __attribute__((__nothrow__)) long double __atan2l(long double __y ,
3078                                                                    long double __x ) ;   3078                                                                    long double __x ) ;
3079 extern  __attribute__((__nothrow__)) long double cosl(long double __x ) ;   3079 extern  __attribute__((__nothrow__)) long double cosl(long double __x ) ;
3080 extern  __attribute__((__nothrow__)) long double __cosl(long double __x ) ;   3080 extern  __attribute__((__nothrow__)) long double __cosl(long double __x ) ;
3081 extern  __attribute__((__nothrow__)) long double sinl(long double __x ) ;   3081 extern  __attribute__((__nothrow__)) long double sinl(long double __x ) ;
3082 extern  __attribute__((__nothrow__)) long double __sinl(long double __x ) ;   3082 extern  __attribute__((__nothrow__)) long double __sinl(long double __x ) ;
3083 extern  __attribute__((__nothrow__)) long double tanl(long double __x ) ;   3083 extern  __attribute__((__nothrow__)) long double tanl(long double __x ) ;
3084 extern  __attribute__((__nothrow__)) long double __tanl(long double __x ) ;   3084 extern  __attribute__((__nothrow__)) long double __tanl(long double __x ) ;
3085 extern  __attribute__((__nothrow__)) long double coshl(long double __x ) ;   3085 extern  __attribute__((__nothrow__)) long double coshl(long double __x ) ;
3086 extern  __attribute__((__nothrow__)) long double __coshl(long double __x ) ;   3086 extern  __attribute__((__nothrow__)) long double __coshl(long double __x ) ;
3087 extern  __attribute__((__nothrow__)) long double sinhl(long double __x ) ;   3087 extern  __attribute__((__nothrow__)) long double sinhl(long double __x ) ;
3088 extern  __attribute__((__nothrow__)) long double __sinhl(long double __x ) ;   3088 extern  __attribute__((__nothrow__)) long double __sinhl(long double __x ) ;
3089 extern  __attribute__((__nothrow__)) long double tanhl(long double __x ) ;   3089 extern  __attribute__((__nothrow__)) long double tanhl(long double __x ) ;
3090 extern  __attribute__((__nothrow__)) long double __tanhl(long double __x ) ;   3090 extern  __attribute__((__nothrow__)) long double __tanhl(long double __x ) ;
3091 extern  __attribute__((__nothrow__)) long double acoshl(long double __x ) ;   3091 extern  __attribute__((__nothrow__)) long double acoshl(long double __x ) ;
3092 extern  __attribute__((__nothrow__)) long double __acoshl(long double __x ) ;   3092 extern  __attribute__((__nothrow__)) long double __acoshl(long double __x ) ;
3093 extern  __attribute__((__nothrow__)) long double asinhl(long double __x ) ;   3093 extern  __attribute__((__nothrow__)) long double asinhl(long double __x ) ;
3094 extern  __attribute__((__nothrow__)) long double __asinhl(long double __x ) ;   3094 extern  __attribute__((__nothrow__)) long double __asinhl(long double __x ) ;
3095 extern  __attribute__((__nothrow__)) long double atanhl(long double __x ) ;   3095 extern  __attribute__((__nothrow__)) long double atanhl(long double __x ) ;
3096 extern  __attribute__((__nothrow__)) long double __atanhl(long double __x ) ;   3096 extern  __attribute__((__nothrow__)) long double __atanhl(long double __x ) ;
3097 extern  __attribute__((__nothrow__)) long double expl(long double __x ) ;   3097 extern  __attribute__((__nothrow__)) long double expl(long double __x ) ;
3098 extern  __attribute__((__nothrow__)) long double __expl(long double __x ) ;   3098 extern  __attribute__((__nothrow__)) long double __expl(long double __x ) ;
3099 extern  __attribute__((__nothrow__)) long double frexpl(long double __x ,   3099 extern  __attribute__((__nothrow__)) long double frexpl(long double __x ,
3100                                                         int *__exponent ) ;   3100                                                         int *__exponent ) ;
3101 extern  __attribute__((__nothrow__)) long double __frexpl(long double __x ,   3101 extern  __attribute__((__nothrow__)) long double __frexpl(long double __x ,
3102                                                           int *__exponent ) ;   3102                                                           int *__exponent ) ;
3103 extern  __attribute__((__nothrow__)) long double ldexpl(long double __x ,   3103 extern  __attribute__((__nothrow__)) long double ldexpl(long double __x ,
3104                                                         int __exponent ) ;   3104                                                         int __exponent ) ;
3105 extern  __attribute__((__nothrow__)) long double __ldexpl(long double __x ,   3105 extern  __attribute__((__nothrow__)) long double __ldexpl(long double __x ,
3106                                                           int __exponent ) ;   3106                                                           int __exponent ) ;
3107 extern  __attribute__((__nothrow__)) long double logl(long double __x ) ;   3107 extern  __attribute__((__nothrow__)) long double logl(long double __x ) ;
3108 extern  __attribute__((__nothrow__)) long double __logl(long double __x ) ;   3108 extern  __attribute__((__nothrow__)) long double __logl(long double __x ) ;
3109 extern  __attribute__((__nothrow__)) long double log10l(long double __x ) ;   3109 extern  __attribute__((__nothrow__)) long double log10l(long double __x ) ;
3110 extern  __attribute__((__nothrow__)) long double __log10l(long double __x ) ;   3110 extern  __attribute__((__nothrow__)) long double __log10l(long double __x ) ;
3111 extern  __attribute__((__nothrow__)) long double modfl(long double __x ,   3111 extern  __attribute__((__nothrow__)) long double modfl(long double __x ,
3112                                                        long double *__iptr ) ;   3112                                                        long double *__iptr ) ;
3113 extern  __attribute__((__nothrow__)) long double __modfl(long double __x ,   3113 extern  __attribute__((__nothrow__)) long double __modfl(long double __x ,
3114                                                          long double *__iptr ) ;   3114                                                          long double *__iptr ) ;
3115 extern  __attribute__((__nothrow__)) long double expm1l(long double __x ) ;   3115 extern  __attribute__((__nothrow__)) long double expm1l(long double __x ) ;
3116 extern  __attribute__((__nothrow__)) long double __expm1l(long double __x ) ;   3116 extern  __attribute__((__nothrow__)) long double __expm1l(long double __x ) ;
3117 extern  __attribute__((__nothrow__)) long double log1pl(long double __x ) ;   3117 extern  __attribute__((__nothrow__)) long double log1pl(long double __x ) ;
3118 extern  __attribute__((__nothrow__)) long double __log1pl(long double __x ) ;   3118 extern  __attribute__((__nothrow__)) long double __log1pl(long double __x ) ;
3119 extern  __attribute__((__nothrow__)) long double logbl(long double __x ) ;   3119 extern  __attribute__((__nothrow__)) long double logbl(long double __x ) ;
3120 extern  __attribute__((__nothrow__)) long double __logbl(long double __x ) ;   3120 extern  __attribute__((__nothrow__)) long double __logbl(long double __x ) ;
3121 extern  __attribute__((__nothrow__)) long double exp2l(long double __x ) ;   3121 extern  __attribute__((__nothrow__)) long double exp2l(long double __x ) ;
3122 extern  __attribute__((__nothrow__)) long double __exp2l(long double __x ) ;   3122 extern  __attribute__((__nothrow__)) long double __exp2l(long double __x ) ;
3123 extern  __attribute__((__nothrow__)) long double log2l(long double __x ) ;   3123 extern  __attribute__((__nothrow__)) long double log2l(long double __x ) ;
3124 extern  __attribute__((__nothrow__)) long double __log2l(long double __x ) ;   3124 extern  __attribute__((__nothrow__)) long double __log2l(long double __x ) ;
3125 extern  __attribute__((__nothrow__)) long double powl(long double __x ,   3125 extern  __attribute__((__nothrow__)) long double powl(long double __x ,
3126                                                       long double __y ) ;   3126                                                       long double __y ) ;
3127 extern  __attribute__((__nothrow__)) long double __powl(long double __x ,   3127 extern  __attribute__((__nothrow__)) long double __powl(long double __x ,
3128                                                         long double __y ) ;   3128                                                         long double __y ) ;
3129 extern  __attribute__((__nothrow__)) long double sqrtl(long double __x ) ;   3129 extern  __attribute__((__nothrow__)) long double sqrtl(long double __x ) ;
3130 extern  __attribute__((__nothrow__)) long double __sqrtl(long double __x ) ;   3130 extern  __attribute__((__nothrow__)) long double __sqrtl(long double __x ) ;
3131 extern  __attribute__((__nothrow__)) long double hypotl(long double __x ,   3131 extern  __attribute__((__nothrow__)) long double hypotl(long double __x ,
3132                                                         long double __y ) ;   3132                                                         long double __y ) ;
3133 extern  __attribute__((__nothrow__)) long double __hypotl(long double __x ,   3133 extern  __attribute__((__nothrow__)) long double __hypotl(long double __x ,
3134                                                           long double __y ) ;   3134                                                           long double __y ) ;
3135 extern  __attribute__((__nothrow__)) long double cbrtl(long double __x ) ;   3135 extern  __attribute__((__nothrow__)) long double cbrtl(long double __x ) ;
3136 extern  __attribute__((__nothrow__)) long double __cbrtl(long double __x ) ;   3136 extern  __attribute__((__nothrow__)) long double __cbrtl(long double __x ) ;
3137 __inline extern  __attribute__((__nothrow__)) long double ceill(long double __x )  __attribute__((__const__)) ;   3137 __inline extern  __attribute__((__nothrow__)) long double ceill(long double __x )  __attribute__((__const__)) ;
3138 extern  __attribute__((__nothrow__)) long double __ceill(long double __x )  __attribute__((__const__)) ;   3138 extern  __attribute__((__nothrow__)) long double __ceill(long double __x )  __attribute__((__const__)) ;
3139 __inline extern  __attribute__((__nothrow__)) long double fabsl(long double __x )  __attribute__((__const__)) ;   3139 __inline extern  __attribute__((__nothrow__)) long double fabsl(long double __x )  __attribute__((__const__)) ;
3140 __inline extern  __attribute__((__nothrow__)) long double __fabsl(long double __x )  __attribute__((__const__)) ;   3140 __inline extern  __attribute__((__nothrow__)) long double __fabsl(long double __x )  __attribute__((__const__)) ;
3141 __inline extern  __attribute__((__nothrow__)) long double floorl(long double __x )  __attribute__((__const__)) ;   3141 __inline extern  __attribute__((__nothrow__)) long double floorl(long double __x )  __attribute__((__const__)) ;
3142 extern  __attribute__((__nothrow__)) long double __floorl(long double __x )  __attribute__((__const__)) ;   3142 extern  __attribute__((__nothrow__)) long double __floorl(long double __x )  __attribute__((__const__)) ;
3143 extern  __attribute__((__nothrow__)) long double fmodl(long double __x ,   3143 extern  __attribute__((__nothrow__)) long double fmodl(long double __x ,
3144                                                        long double __y ) ;   3144                                                        long double __y ) ;
3145 extern  __attribute__((__nothrow__)) long double __fmodl(long double __x ,   3145 extern  __attribute__((__nothrow__)) long double __fmodl(long double __x ,
3146                                                          long double __y ) ;   3146                                                          long double __y ) ;
3147 extern  __attribute__((__nothrow__)) int __isinfl(long double __value )  __attribute__((__const__)) ;   3147 extern  __attribute__((__nothrow__)) int __isinfl(long double __value )  __attribute__((__const__)) ;
3148 extern  __attribute__((__nothrow__)) int __finitel(long double __value )  __attribute__((__const__)) ;   3148 extern  __attribute__((__nothrow__)) int __finitel(long double __value )  __attribute__((__const__)) ;
3149 extern  __attribute__((__nothrow__)) int isinfl(long double __value )  __attribute__((__const__)) ;   3149 extern  __attribute__((__nothrow__)) int isinfl(long double __value )  __attribute__((__const__)) ;
3150 extern  __attribute__((__nothrow__)) int finitel(long double __value )  __attribute__((__const__)) ;   3150 extern  __attribute__((__nothrow__)) int finitel(long double __value )  __attribute__((__const__)) ;
3151 extern  __attribute__((__nothrow__)) long double dreml(long double __x ,   3151 extern  __attribute__((__nothrow__)) long double dreml(long double __x ,
3152                                                        long double __y ) ;   3152                                                        long double __y ) ;
3153 extern  __attribute__((__nothrow__)) long double __dreml(long double __x ,   3153 extern  __attribute__((__nothrow__)) long double __dreml(long double __x ,
3154                                                          long double __y ) ;   3154                                                          long double __y ) ;
3155 extern  __attribute__((__nothrow__)) long double significandl(long double __x ) ;   3155 extern  __attribute__((__nothrow__)) long double significandl(long double __x ) ;
3156 extern  __attribute__((__nothrow__)) long double __significandl(long double __x ) ;   3156 extern  __attribute__((__nothrow__)) long double __significandl(long double __x ) ;
3157 extern  __attribute__((__nothrow__)) long double copysignl(long double __x ,   3157 extern  __attribute__((__nothrow__)) long double copysignl(long double __x ,
3158                                                            long double __y )  __attribute__((__const__)) ;   3158                                                            long double __y )  __attribute__((__const__)) ;
3159 extern  __attribute__((__nothrow__)) long double __copysignl(long double __x ,   3159 extern  __attribute__((__nothrow__)) long double __copysignl(long double __x ,
3160                                                              long double __y )  __attribute__((__const__)) ;   3160                                                              long double __y )  __attribute__((__const__)) ;
3161 extern  __attribute__((__nothrow__)) long double nanl(char const   *__tagb )  __attribute__((__const__)) ;   3161 extern  __attribute__((__nothrow__)) long double nanl(char const   *__tagb )  __attribute__((__const__)) ;
3162 extern  __attribute__((__nothrow__)) long double __nanl(char const   *__tagb )  __attribute__((__const__)) ;   3162 extern  __attribute__((__nothrow__)) long double __nanl(char const   *__tagb )  __attribute__((__const__)) ;
3163 extern  __attribute__((__nothrow__)) int __isnanl(long double __value )  __attribute__((__const__)) ;   3163 extern  __attribute__((__nothrow__)) int __isnanl(long double __value )  __attribute__((__const__)) ;
3164 extern  __attribute__((__nothrow__)) int isnanl(long double __value )  __attribute__((__const__)) ;   3164 extern  __attribute__((__nothrow__)) int isnanl(long double __value )  __attribute__((__const__)) ;
3165 extern  __attribute__((__nothrow__)) long double j0l(long double  ) ;   3165 extern  __attribute__((__nothrow__)) long double j0l(long double  ) ;
3166 extern  __attribute__((__nothrow__)) long double __j0l(long double  ) ;   3166 extern  __attribute__((__nothrow__)) long double __j0l(long double  ) ;
3167 extern  __attribute__((__nothrow__)) long double j1l(long double  ) ;   3167 extern  __attribute__((__nothrow__)) long double j1l(long double  ) ;
3168 extern  __attribute__((__nothrow__)) long double __j1l(long double  ) ;   3168 extern  __attribute__((__nothrow__)) long double __j1l(long double  ) ;
3169 extern  __attribute__((__nothrow__)) long double jnl(int  , long double  ) ;   3169 extern  __attribute__((__nothrow__)) long double jnl(int  , long double  ) ;
3170 extern  __attribute__((__nothrow__)) long double __jnl(int  , long double  ) ;   3170 extern  __attribute__((__nothrow__)) long double __jnl(int  , long double  ) ;
3171 extern  __attribute__((__nothrow__)) long double y0l(long double  ) ;   3171 extern  __attribute__((__nothrow__)) long double y0l(long double  ) ;
3172 extern  __attribute__((__nothrow__)) long double __y0l(long double  ) ;   3172 extern  __attribute__((__nothrow__)) long double __y0l(long double  ) ;
3173 extern  __attribute__((__nothrow__)) long double y1l(long double  ) ;   3173 extern  __attribute__((__nothrow__)) long double y1l(long double  ) ;
3174 extern  __attribute__((__nothrow__)) long double __y1l(long double  ) ;   3174 extern  __attribute__((__nothrow__)) long double __y1l(long double  ) ;
3175 extern  __attribute__((__nothrow__)) long double ynl(int  , long double  ) ;   3175 extern  __attribute__((__nothrow__)) long double ynl(int  , long double  ) ;
3176 extern  __attribute__((__nothrow__)) long double __ynl(int  , long double  ) ;   3176 extern  __attribute__((__nothrow__)) long double __ynl(int  , long double  ) ;
3177 extern  __attribute__((__nothrow__)) long double erfl(long double  ) ;   3177 extern  __attribute__((__nothrow__)) long double erfl(long double  ) ;
3178 extern  __attribute__((__nothrow__)) long double __erfl(long double  ) ;   3178 extern  __attribute__((__nothrow__)) long double __erfl(long double  ) ;
3179 extern  __attribute__((__nothrow__)) long double erfcl(long double  ) ;   3179 extern  __attribute__((__nothrow__)) long double erfcl(long double  ) ;
3180 extern  __attribute__((__nothrow__)) long double __erfcl(long double  ) ;   3180 extern  __attribute__((__nothrow__)) long double __erfcl(long double  ) ;
3181 extern  __attribute__((__nothrow__)) long double lgammal(long double  ) ;   3181 extern  __attribute__((__nothrow__)) long double lgammal(long double  ) ;
3182 extern  __attribute__((__nothrow__)) long double __lgammal(long double  ) ;   3182 extern  __attribute__((__nothrow__)) long double __lgammal(long double  ) ;
3183 extern  __attribute__((__nothrow__)) long double tgammal(long double  ) ;   3183 extern  __attribute__((__nothrow__)) long double tgammal(long double  ) ;
3184 extern  __attribute__((__nothrow__)) long double __tgammal(long double  ) ;   3184 extern  __attribute__((__nothrow__)) long double __tgammal(long double  ) ;
3185 extern  __attribute__((__nothrow__)) long double gammal(long double  ) ;   3185 extern  __attribute__((__nothrow__)) long double gammal(long double  ) ;
3186 extern  __attribute__((__nothrow__)) long double __gammal(long double  ) ;   3186 extern  __attribute__((__nothrow__)) long double __gammal(long double  ) ;
3187 extern  __attribute__((__nothrow__)) long double lgammal_r(long double  ,   3187 extern  __attribute__((__nothrow__)) long double lgammal_r(long double  ,
3188                                                            int *__signgamp ) ;   3188                                                            int *__signgamp ) ;
3189 extern  __attribute__((__nothrow__)) long double __lgammal_r(long double  ,   3189 extern  __attribute__((__nothrow__)) long double __lgammal_r(long double  ,
3190                                                              int *__signgamp ) ;   3190                                                              int *__signgamp ) ;
3191 extern  __attribute__((__nothrow__)) long double rintl(long double __x ) ;   3191 extern  __attribute__((__nothrow__)) long double rintl(long double __x ) ;
3192 extern  __attribute__((__nothrow__)) long double __rintl(long double __x ) ;   3192 extern  __attribute__((__nothrow__)) long double __rintl(long double __x ) ;
3193 extern  __attribute__((__nothrow__)) long double nextafterl(long double __x ,   3193 extern  __attribute__((__nothrow__)) long double nextafterl(long double __x ,
3194                                                             long double __y )  __attribute__((__const__)) ;   3194                                                             long double __y )  __attribute__((__const__)) ;
3195 extern  __attribute__((__nothrow__)) long double __nextafterl(long double __x ,   3195 extern  __attribute__((__nothrow__)) long double __nextafterl(long double __x ,
3196                                                               long double __y )  __attribute__((__const__)) ;   3196                                                               long double __y )  __attribute__((__const__)) ;
3197 extern  __attribute__((__nothrow__)) long double nexttowardl(long double __x ,   3197 extern  __attribute__((__nothrow__)) long double nexttowardl(long double __x ,
3198                                                              long double __y )  __attribute__((__const__)) ;   3198                                                              long double __y )  __attribute__((__const__)) ;
3199 extern  __attribute__((__nothrow__)) long double __nexttowardl(long double __x ,   3199 extern  __attribute__((__nothrow__)) long double __nexttowardl(long double __x ,
3200                                                                long double __y )  __attribute__((__const__)) ;   3200                                                                long double __y )  __attribute__((__const__)) ;
3201 extern  __attribute__((__nothrow__)) long double remainderl(long double __x ,   3201 extern  __attribute__((__nothrow__)) long double remainderl(long double __x ,
3202                                                             long double __y ) ;   3202                                                             long double __y ) ;
3203 extern  __attribute__((__nothrow__)) long double __remainderl(long double __x ,   3203 extern  __attribute__((__nothrow__)) long double __remainderl(long double __x ,
3204                                                               long double __y ) ;   3204                                                               long double __y ) ;
3205 extern  __attribute__((__nothrow__)) long double scalbnl(long double __x ,   3205 extern  __attribute__((__nothrow__)) long double scalbnl(long double __x ,
3206                                                          int __n ) ;   3206                                                          int __n ) ;
3207 extern  __attribute__((__nothrow__)) long double __scalbnl(long double __x ,   3207 extern  __attribute__((__nothrow__)) long double __scalbnl(long double __x ,
3208                                                            int __n ) ;   3208                                                            int __n ) ;
3209 extern  __attribute__((__nothrow__)) int ilogbl(long double __x ) ;   3209 extern  __attribute__((__nothrow__)) int ilogbl(long double __x ) ;
3210 extern  __attribute__((__nothrow__)) int __ilogbl(long double __x ) ;   3210 extern  __attribute__((__nothrow__)) int __ilogbl(long double __x ) ;
3211 extern  __attribute__((__nothrow__)) long double scalblnl(long double __x ,   3211 extern  __attribute__((__nothrow__)) long double scalblnl(long double __x ,
3212                                                           long __n ) ;   3212                                                           long __n ) ;
3213 extern  __attribute__((__nothrow__)) long double __scalblnl(long double __x ,   3213 extern  __attribute__((__nothrow__)) long double __scalblnl(long double __x ,
3214                                                             long __n ) ;   3214                                                             long __n ) ;
3215 extern  __attribute__((__nothrow__)) long double nearbyintl(long double __x ) ;   3215 extern  __attribute__((__nothrow__)) long double nearbyintl(long double __x ) ;
3216 extern  __attribute__((__nothrow__)) long double __nearbyintl(long double __x ) ;   3216 extern  __attribute__((__nothrow__)) long double __nearbyintl(long double __x ) ;
3217 extern  __attribute__((__nothrow__)) long double roundl(long double __x )  __attribute__((__const__)) ;   3217 extern  __attribute__((__nothrow__)) long double roundl(long double __x )  __attribute__((__const__)) ;
3218 extern  __attribute__((__nothrow__)) long double __roundl(long double __x )  __attribute__((__const__)) ;   3218 extern  __attribute__((__nothrow__)) long double __roundl(long double __x )  __attribute__((__const__)) ;
3219 extern  __attribute__((__nothrow__)) long double truncl(long double __x )  __attribute__((__const__)) ;   3219 extern  __attribute__((__nothrow__)) long double truncl(long double __x )  __attribute__((__const__)) ;
3220 extern  __attribute__((__nothrow__)) long double __truncl(long double __x )  __attribute__((__const__)) ;   3220 extern  __attribute__((__nothrow__)) long double __truncl(long double __x )  __attribute__((__const__)) ;
3221 extern  __attribute__((__nothrow__)) long double remquol(long double __x ,   3221 extern  __attribute__((__nothrow__)) long double remquol(long double __x ,
3222                                                          long double __y ,   3222                                                          long double __y ,
3223                                                          int *__quo ) ;   3223                                                          int *__quo ) ;
3224 extern  __attribute__((__nothrow__)) long double __remquol(long double __x ,   3224 extern  __attribute__((__nothrow__)) long double __remquol(long double __x ,
3225                                                            long double __y ,   3225                                                            long double __y ,
3226                                                            int *__quo ) ;   3226                                                            int *__quo ) ;
3227 __inline extern  __attribute__((__nothrow__)) long lrintl(long double __x ) ;   3227 __inline extern  __attribute__((__nothrow__)) long lrintl(long double __x ) ;
3228 extern  __attribute__((__nothrow__)) long __lrintl(long double __x ) ;   3228 extern  __attribute__((__nothrow__)) long __lrintl(long double __x ) ;
3229 __inline extern  __attribute__((__nothrow__)) long long llrintl(long double __x ) ;   3229 __inline extern  __attribute__((__nothrow__)) long long llrintl(long double __x ) ;
3230 extern  __attribute__((__nothrow__)) long long __llrintl(long double __x ) ;   3230 extern  __attribute__((__nothrow__)) long long __llrintl(long double __x ) ;
3231 extern  __attribute__((__nothrow__)) long lroundl(long double __x ) ;   3231 extern  __attribute__((__nothrow__)) long lroundl(long double __x ) ;
3232 extern  __attribute__((__nothrow__)) long __lroundl(long double __x ) ;   3232 extern  __attribute__((__nothrow__)) long __lroundl(long double __x ) ;
3233 extern  __attribute__((__nothrow__)) long long llroundl(long double __x ) ;   3233 extern  __attribute__((__nothrow__)) long long llroundl(long double __x ) ;
3234 extern  __attribute__((__nothrow__)) long long __llroundl(long double __x ) ;   3234 extern  __attribute__((__nothrow__)) long long __llroundl(long double __x ) ;
3235 extern  __attribute__((__nothrow__)) long double fdiml(long double __x ,   3235 extern  __attribute__((__nothrow__)) long double fdiml(long double __x ,
3236                                                        long double __y ) ;   3236                                                        long double __y ) ;
3237 extern  __attribute__((__nothrow__)) long double __fdiml(long double __x ,   3237 extern  __attribute__((__nothrow__)) long double __fdiml(long double __x ,
3238                                                          long double __y ) ;   3238                                                          long double __y ) ;
3239 extern  __attribute__((__nothrow__)) long double fmaxl(long double __x ,   3239 extern  __attribute__((__nothrow__)) long double fmaxl(long double __x ,
3240                                                        long double __y ) ;   3240                                                        long double __y ) ;
3241 extern  __attribute__((__nothrow__)) long double __fmaxl(long double __x ,   3241 extern  __attribute__((__nothrow__)) long double __fmaxl(long double __x ,
3242                                                          long double __y ) ;   3242                                                          long double __y ) ;
3243 extern  __attribute__((__nothrow__)) long double fminl(long double __x ,   3243 extern  __attribute__((__nothrow__)) long double fminl(long double __x ,
3244                                                        long double __y ) ;   3244                                                        long double __y ) ;
3245 extern  __attribute__((__nothrow__)) long double __fminl(long double __x ,   3245 extern  __attribute__((__nothrow__)) long double __fminl(long double __x ,
3246                                                          long double __y ) ;   3246                                                          long double __y ) ;
3247 extern  __attribute__((__nothrow__)) int __fpclassifyl(long double __value )  __attribute__((__const__)) ;   3247 extern  __attribute__((__nothrow__)) int __fpclassifyl(long double __value )  __attribute__((__const__)) ;
3248 __inline extern  __attribute__((__nothrow__)) int __signbitl(long double __x )  __attribute__((__const__)) ;   3248 __inline extern  __attribute__((__nothrow__)) int __signbitl(long double __x )  __attribute__((__const__)) ;
3249 extern  __attribute__((__nothrow__)) long double fmal(long double __x ,   3249 extern  __attribute__((__nothrow__)) long double fmal(long double __x ,
3250                                                       long double __y ,   3250                                                       long double __y ,
3251                                                       long double __z ) ;   3251                                                       long double __z ) ;
3252 extern  __attribute__((__nothrow__)) long double __fmal(long double __x ,   3252 extern  __attribute__((__nothrow__)) long double __fmal(long double __x ,
3253                                                         long double __y ,   3253                                                         long double __y ,
3254                                                         long double __z ) ;   3254                                                         long double __z ) ;
3255 extern  __attribute__((__nothrow__)) long double scalbl(long double __x ,   3255 extern  __attribute__((__nothrow__)) long double scalbl(long double __x ,
3256                                                         long double __n ) ;   3256                                                         long double __n ) ;
3257 extern  __attribute__((__nothrow__)) long double __scalbl(long double __x ,   3257 extern  __attribute__((__nothrow__)) long double __scalbl(long double __x ,
3258                                                           long double __n ) ;   3258                                                           long double __n ) ;
3259 extern int signgam ;   3259 extern int signgam ;
3260 extern _LIB_VERSION_TYPE _LIB_VERSION ;   3260 extern _LIB_VERSION_TYPE _LIB_VERSION ;
3261 extern int matherr(struct exception *__exc ) ;   3261 extern int matherr(struct exception *__exc ) ;
3262 __inline extern  __attribute__((__nothrow__)) int __signbitf(float __x )  __attribute__((__const__)) ;   3262 __inline extern  __attribute__((__nothrow__)) int __signbitf(float __x )  __attribute__((__const__)) ;
3263 __inline extern int __signbitf(float __x )   3263 __inline extern int __signbitf(float __x )
3264 {   3264 {
3265   union __anonunion___u_48 __u ;   3265   union __anonunion___u_48 __u ;
3266     3266  
3267   {   3267   {
3268   __u.__f = __x;   3268   __u.__f = __x;
3269   return (__u.__i < 0);   3269   return (__u.__i < 0);
3270 }   3270 }
3271 }   3271 }
3272 __inline extern  __attribute__((__nothrow__)) int __signbit(double __x )  __attribute__((__const__)) ;   3272 __inline extern  __attribute__((__nothrow__)) int __signbit(double __x )  __attribute__((__const__)) ;
3273 __inline extern int __signbit(double __x )   3273 __inline extern int __signbit(double __x )
3274 {   3274 {
3275   union __anonunion___u_49 __u ;   3275   union __anonunion___u_49 __u ;
3276     3276  
3277   {   3277   {
3278   __u.__d = __x;   3278   __u.__d = __x;
3279   return (__u.__i[1] < 0);   3279   return (__u.__i[1] < 0);
3280 }   3280 }
3281 }   3281 }
3282 __inline extern  __attribute__((__nothrow__)) int __signbitl(long double __x )  __attribute__((__const__)) ;   3282 __inline extern  __attribute__((__nothrow__)) int __signbitl(long double __x )  __attribute__((__const__)) ;
3283 __inline extern int __signbitl(long double __x )   3283 __inline extern int __signbitl(long double __x )
3284 {   3284 {
3285   union __anonunion___u_50 __u ;   3285   union __anonunion___u_50 __u ;
3286     3286  
3287   {   3287   {
3288   __u.__l = __x;   3288   __u.__l = __x;
3289   return ((__u.__i[2] & 32768) != 0);   3289   return ((__u.__i[2] & 32768) != 0);
3290 }   3290 }
3291 }   3291 }
3292 __inline extern  __attribute__((__nothrow__)) double __sgn(double __x ) ;   3292 __inline extern  __attribute__((__nothrow__)) double __sgn(double __x ) ;
3293 __inline extern  __attribute__((__nothrow__)) double __sgn(double __x ) ;   3293 __inline extern  __attribute__((__nothrow__)) double __sgn(double __x ) ;
3294 __inline extern double __sgn(double __x )   3294 __inline extern double __sgn(double __x )
3295 {   3295 {
3296   double tmp ;   3296   double tmp ;
3297   double tmp___0 ;   3297   double tmp___0 ;
3298     3298  
3299   {   3299   {
3300   if (__x == 0.0) {   3300   if (__x == 0.0) {
3301     tmp___0 = 0.0;   3301     tmp___0 = 0.0;
3302   } else {   3302   } else {
3303     if (__x > 0.0) {   3303     if (__x > 0.0) {
3304       tmp = 1.0;   3304       tmp = 1.0;
3305     } else {   3305     } else {
3306       tmp = - 1.0;   3306       tmp = - 1.0;
3307     }   3307     }
3308     tmp___0 = tmp;   3308     tmp___0 = tmp;
3309   }   3309   }
3310   return (tmp___0);   3310   return (tmp___0);
3311 }   3311 }
3312 }   3312 }
3313 __inline extern  __attribute__((__nothrow__)) float __sgnf(float __x ) ;   3313 __inline extern  __attribute__((__nothrow__)) float __sgnf(float __x ) ;
3314 __inline extern  __attribute__((__nothrow__)) float __sgnf(float __x ) ;   3314 __inline extern  __attribute__((__nothrow__)) float __sgnf(float __x ) ;
3315 __inline extern float __sgnf(float __x )   3315 __inline extern float __sgnf(float __x )
3316 {   3316 {
3317   double tmp ;   3317   double tmp ;
3318   double tmp___0 ;   3318   double tmp___0 ;
3319     3319  
3320   {   3320   {
3321   if ((double )__x == 0.0) {   3321   if ((double )__x == 0.0) {
3322     tmp___0 = 0.0;   3322     tmp___0 = 0.0;
3323   } else {   3323   } else {
3324     if ((double )__x > 0.0) {   3324     if ((double )__x > 0.0) {
3325       tmp = 1.0;   3325       tmp = 1.0;
3326     } else {   3326     } else {
3327       tmp = - 1.0;   3327       tmp = - 1.0;
3328     }   3328     }
3329     tmp___0 = tmp;   3329     tmp___0 = tmp;
3330   }   3330   }
3331   return ((float )tmp___0);   3331   return ((float )tmp___0);
3332 }   3332 }
3333 }   3333 }
3334 __inline extern  __attribute__((__nothrow__)) long double __sgnl(long double __x ) ;   3334 __inline extern  __attribute__((__nothrow__)) long double __sgnl(long double __x ) ;
3335 __inline extern  __attribute__((__nothrow__)) long double __sgnl(long double __x ) ;   3335 __inline extern  __attribute__((__nothrow__)) long double __sgnl(long double __x ) ;
3336 __inline extern long double __sgnl(long double __x )   3336 __inline extern long double __sgnl(long double __x )
3337 {   3337 {
3338   double tmp ;   3338   double tmp ;
3339   double tmp___0 ;   3339   double tmp___0 ;
3340     3340  
3341   {   3341   {
3342   if (__x == (long double )0.0) {   3342   if (__x == (long double )0.0) {
3343     tmp___0 = 0.0;   3343     tmp___0 = 0.0;
3344   } else {   3344   } else {
3345     if (__x > (long double )0.0) {   3345     if (__x > (long double )0.0) {
3346       tmp = 1.0;   3346       tmp = 1.0;
3347     } else {   3347     } else {
3348       tmp = - 1.0;   3348       tmp = - 1.0;
3349     }   3349     }
3350     tmp___0 = tmp;   3350     tmp___0 = tmp;
3351   }   3351   }
3352   return ((long double )tmp___0);   3352   return ((long double )tmp___0);
3353 }   3353 }
3354 }   3354 }
3355 __inline extern  __attribute__((__nothrow__)) long double __atan2l(long double __y ,   3355 __inline extern  __attribute__((__nothrow__)) long double __atan2l(long double __y ,
3356                                                                    long double __x ) ;   3356                                                                    long double __x ) ;
3357 __inline extern long double __atan2l(long double __y , long double __x )   3357 __inline extern long double __atan2l(long double __y , long double __x )
3358 {   3358 {
3359   long double tmp ;   3359   long double tmp ;
3360     3360  
3361   {   3361   {
3362   tmp = __builtin_atan2l(__y, __x);   3362   tmp = __builtin_atan2l(__y, __x);
3363   return (tmp);   3363   return (tmp);
3364 }   3364 }
3365 }   3365 }
3366 __inline extern  __attribute__((__nothrow__)) double fabs(double __x )  __attribute__((__const__)) ;   3366 __inline extern  __attribute__((__nothrow__)) double fabs(double __x )  __attribute__((__const__)) ;
3367 __inline extern double fabs(double __x )   3367 __inline extern double fabs(double __x )
3368 {   3368 {
3369   double tmp ;   3369   double tmp ;
3370     3370  
3371   {   3371   {
3372   tmp = __builtin_fabs(__x);   3372   tmp = __builtin_fabs(__x);
3373   return (tmp);   3373   return (tmp);
3374 }   3374 }
3375 }   3375 }
3376 __inline extern  __attribute__((__nothrow__)) float fabsf(float __x )  __attribute__((__const__)) ;   3376 __inline extern  __attribute__((__nothrow__)) float fabsf(float __x )  __attribute__((__const__)) ;
3377 __inline extern float fabsf(float __x )   3377 __inline extern float fabsf(float __x )
3378 {   3378 {
3379   float tmp ;   3379   float tmp ;
3380     3380  
3381   {   3381   {
3382   tmp = __builtin_fabsf(__x);   3382   tmp = __builtin_fabsf(__x);
3383   return (tmp);   3383   return (tmp);
3384 }   3384 }
3385 }   3385 }
3386 __inline extern  __attribute__((__nothrow__)) long double fabsl(long double __x )  __attribute__((__const__)) ;   3386 __inline extern  __attribute__((__nothrow__)) long double fabsl(long double __x )  __attribute__((__const__)) ;
3387 __inline extern long double fabsl(long double __x )   3387 __inline extern long double fabsl(long double __x )
3388 {   3388 {
3389   long double tmp ;   3389   long double tmp ;
3390     3390  
3391   {   3391   {
3392   tmp = __builtin_fabsl(__x);   3392   tmp = __builtin_fabsl(__x);
3393   return (tmp);   3393   return (tmp);
3394 }   3394 }
3395 }   3395 }
3396 __inline extern  __attribute__((__nothrow__)) long double __fabsl(long double __x )  __attribute__((__const__)) ;   3396 __inline extern  __attribute__((__nothrow__)) long double __fabsl(long double __x )  __attribute__((__const__)) ;
3397 __inline extern long double __fabsl(long double __x )   3397 __inline extern long double __fabsl(long double __x )
3398 {   3398 {
3399   long double tmp ;   3399   long double tmp ;
3400     3400  
3401   {   3401   {
3402   tmp = __builtin_fabsl(__x);   3402   tmp = __builtin_fabsl(__x);
3403   return (tmp);   3403   return (tmp);
3404 }   3404 }
3405 }   3405 }
3406 __inline extern  __attribute__((__nothrow__)) long double __sgn1l(long double __x ) ;   3406 __inline extern  __attribute__((__nothrow__)) long double __sgn1l(long double __x ) ;
3407 __inline extern  __attribute__((__nothrow__)) long double __sgn1l(long double __x ) ;   3407 __inline extern  __attribute__((__nothrow__)) long double __sgn1l(long double __x ) ;
3408 __inline extern long double __sgn1l(long double __x )   3408 __inline extern long double __sgn1l(long double __x )
3409 {   3409 {
3410   union __anonunion___n_51 __n ;   3410   union __anonunion___n_51 __n ;
3411     3411  
3412   {   3412   {
3413   __n.__xld = __x;   3413   __n.__xld = __x;
3414   __n.__xi[2] = (__n.__xi[2] & 32768U) | 16383U;   3414   __n.__xi[2] = (__n.__xi[2] & 32768U) | 16383U;
3415   __n.__xi[1] = 2147483648U;   3415   __n.__xi[1] = 2147483648U;
3416   __n.__xi[0] = 0U;   3416   __n.__xi[0] = 0U;
3417   return (__n.__xld);   3417   return (__n.__xld);
3418 }   3418 }
3419 }   3419 }
3420 __inline extern  __attribute__((__nothrow__)) double floor(double __x )  __attribute__((__const__)) ;   3420 __inline extern  __attribute__((__nothrow__)) double floor(double __x )  __attribute__((__const__)) ;
3421 __inline extern double floor(double __x )   3421 __inline extern double floor(double __x )
3422 {   3422 {
3423   register long double __value ;   3423   register long double __value ;
3424   register int __ignore ;   3424   register int __ignore ;
3425   unsigned short __cw ;   3425   unsigned short __cw ;
3426   unsigned short __cwtmp ;   3426   unsigned short __cwtmp ;
3427     3427  
3428   {   3428   {
3429   __asm__  volatile   ("fnstcw %3\n\t"   3429   __asm__  volatile   ("fnstcw %3\n\t"
3430                        "movzwl %3, %1\n\t"   3430                        "movzwl %3, %1\n\t"
3431                        "andl $0xf3ff, %1\n\t"   3431                        "andl $0xf3ff, %1\n\t"
3432                        "orl $0x0400, %1\n\t"   3432                        "orl $0x0400, %1\n\t"
3433                        "movw %w1, %2\n\t"   3433                        "movw %w1, %2\n\t"
3434                        "fldcw %2\n\t"   3434                        "fldcw %2\n\t"
3435                        "frndint\n\t"   3435                        "frndint\n\t"
3436                        "fldcw %3": "=t" (__value), "=&q" (__ignore),   3436                        "fldcw %3": "=t" (__value), "=&q" (__ignore),
3437                        "=m" (__cwtmp), "=m" (__cw): "0" (__x));   3437                        "=m" (__cwtmp), "=m" (__cw): "0" (__x));
3438   return ((double )__value);   3438   return ((double )__value);
3439 }   3439 }
3440 }   3440 }
3441 __inline extern  __attribute__((__nothrow__)) float floorf(float __x )  __attribute__((__const__)) ;   3441 __inline extern  __attribute__((__nothrow__)) float floorf(float __x )  __attribute__((__const__)) ;
3442 __inline extern float floorf(float __x )   3442 __inline extern float floorf(float __x )
3443 {   3443 {
3444   register long double __value ;   3444   register long double __value ;
3445   register int __ignore ;   3445   register int __ignore ;
3446   unsigned short __cw ;   3446   unsigned short __cw ;
3447   unsigned short __cwtmp ;   3447   unsigned short __cwtmp ;
3448     3448  
3449   {   3449   {
3450   __asm__  volatile   ("fnstcw %3\n\t"   3450   __asm__  volatile   ("fnstcw %3\n\t"
3451                        "movzwl %3, %1\n\t"   3451                        "movzwl %3, %1\n\t"
3452                        "andl $0xf3ff, %1\n\t"   3452                        "andl $0xf3ff, %1\n\t"
3453                        "orl $0x0400, %1\n\t"   3453                        "orl $0x0400, %1\n\t"
3454                        "movw %w1, %2\n\t"   3454                        "movw %w1, %2\n\t"
3455                        "fldcw %2\n\t"   3455                        "fldcw %2\n\t"
3456                        "frndint\n\t"   3456                        "frndint\n\t"
3457                        "fldcw %3": "=t" (__value), "=&q" (__ignore),   3457                        "fldcw %3": "=t" (__value), "=&q" (__ignore),
3458                        "=m" (__cwtmp), "=m" (__cw): "0" (__x));   3458                        "=m" (__cwtmp), "=m" (__cw): "0" (__x));
3459   return ((float )__value);   3459   return ((float )__value);
3460 }   3460 }
3461 }   3461 }
3462 __inline extern  __attribute__((__nothrow__)) long double floorl(long double __x )  __attribute__((__const__)) ;   3462 __inline extern  __attribute__((__nothrow__)) long double floorl(long double __x )  __attribute__((__const__)) ;
3463 __inline extern long double floorl(long double __x )   3463 __inline extern long double floorl(long double __x )
3464 {   3464 {
3465   register long double __value ;   3465   register long double __value ;
3466   register int __ignore ;   3466   register int __ignore ;
3467   unsigned short __cw ;   3467   unsigned short __cw ;
3468   unsigned short __cwtmp ;   3468   unsigned short __cwtmp ;
3469     3469  
3470   {   3470   {
3471   __asm__  volatile   ("fnstcw %3\n\t"   3471   __asm__  volatile   ("fnstcw %3\n\t"
3472                        "movzwl %3, %1\n\t"   3472                        "movzwl %3, %1\n\t"
3473                        "andl $0xf3ff, %1\n\t"   3473                        "andl $0xf3ff, %1\n\t"
3474                        "orl $0x0400, %1\n\t"   3474                        "orl $0x0400, %1\n\t"
3475                        "movw %w1, %2\n\t"   3475                        "movw %w1, %2\n\t"
3476                        "fldcw %2\n\t"   3476                        "fldcw %2\n\t"
3477                        "frndint\n\t"   3477                        "frndint\n\t"
3478                        "fldcw %3": "=t" (__value), "=&q" (__ignore),   3478                        "fldcw %3": "=t" (__value), "=&q" (__ignore),
3479                        "=m" (__cwtmp), "=m" (__cw): "0" (__x));   3479                        "=m" (__cwtmp), "=m" (__cw): "0" (__x));
3480   return (__value);   3480   return (__value);
3481 }   3481 }
3482 }   3482 }
3483 __inline extern  __attribute__((__nothrow__)) double ceil(double __x )  __attribute__((__const__)) ;   3483 __inline extern  __attribute__((__nothrow__)) double ceil(double __x )  __attribute__((__const__)) ;
3484 __inline extern double ceil(double __x )   3484 __inline extern double ceil(double __x )
3485 {   3485 {
3486   register long double __value ;   3486   register long double __value ;
3487   register int __ignore ;   3487   register int __ignore ;
3488   unsigned short __cw ;   3488   unsigned short __cw ;
3489   unsigned short __cwtmp ;   3489   unsigned short __cwtmp ;
3490     3490  
3491   {   3491   {
3492   __asm__  volatile   ("fnstcw %3\n\t"   3492   __asm__  volatile   ("fnstcw %3\n\t"
3493                        "movzwl %3, %1\n\t"   3493                        "movzwl %3, %1\n\t"
3494                        "andl $0xf3ff, %1\n\t"   3494                        "andl $0xf3ff, %1\n\t"
3495                        "orl $0x0800, %1\n\t"   3495                        "orl $0x0800, %1\n\t"
3496                        "movw %w1, %2\n\t"   3496                        "movw %w1, %2\n\t"
3497                        "fldcw %2\n\t"   3497                        "fldcw %2\n\t"
3498                        "frndint\n\t"   3498                        "frndint\n\t"
3499                        "fldcw %3": "=t" (__value), "=&q" (__ignore),   3499                        "fldcw %3": "=t" (__value), "=&q" (__ignore),
3500                        "=m" (__cwtmp), "=m" (__cw): "0" (__x));   3500                        "=m" (__cwtmp), "=m" (__cw): "0" (__x));
3501   return ((double )__value);   3501   return ((double )__value);
3502 }   3502 }
3503 }   3503 }
3504 __inline extern  __attribute__((__nothrow__)) float ceilf(float __x )  __attribute__((__const__)) ;   3504 __inline extern  __attribute__((__nothrow__)) float ceilf(float __x )  __attribute__((__const__)) ;
3505 __inline extern float ceilf(float __x )   3505 __inline extern float ceilf(float __x )
3506 {   3506 {
3507   register long double __value ;   3507   register long double __value ;
3508   register int __ignore ;   3508   register int __ignore ;
3509   unsigned short __cw ;   3509   unsigned short __cw ;
3510   unsigned short __cwtmp ;   3510   unsigned short __cwtmp ;
3511     3511  
3512   {   3512   {
3513   __asm__  volatile   ("fnstcw %3\n\t"   3513   __asm__  volatile   ("fnstcw %3\n\t"
3514                        "movzwl %3, %1\n\t"   3514                        "movzwl %3, %1\n\t"
3515                        "andl $0xf3ff, %1\n\t"   3515                        "andl $0xf3ff, %1\n\t"
3516                        "orl $0x0800, %1\n\t"   3516                        "orl $0x0800, %1\n\t"
3517                        "movw %w1, %2\n\t"   3517                        "movw %w1, %2\n\t"
3518                        "fldcw %2\n\t"   3518                        "fldcw %2\n\t"
3519                        "frndint\n\t"   3519                        "frndint\n\t"
3520                        "fldcw %3": "=t" (__value), "=&q" (__ignore),   3520                        "fldcw %3": "=t" (__value), "=&q" (__ignore),
3521                        "=m" (__cwtmp), "=m" (__cw): "0" (__x));   3521                        "=m" (__cwtmp), "=m" (__cw): "0" (__x));
3522   return ((float )__value);   3522   return ((float )__value);
3523 }   3523 }
3524 }   3524 }
3525 __inline extern  __attribute__((__nothrow__)) long double ceill(long double __x )  __attribute__((__const__)) ;   3525 __inline extern  __attribute__((__nothrow__)) long double ceill(long double __x )  __attribute__((__const__)) ;
3526 __inline extern long double ceill(long double __x )   3526 __inline extern long double ceill(long double __x )
3527 {   3527 {
3528   register long double __value ;   3528   register long double __value ;
3529   register int __ignore ;   3529   register int __ignore ;
3530   unsigned short __cw ;   3530   unsigned short __cw ;
3531   unsigned short __cwtmp ;   3531   unsigned short __cwtmp ;
3532     3532  
3533   {   3533   {
3534   __asm__  volatile   ("fnstcw %3\n\t"   3534   __asm__  volatile   ("fnstcw %3\n\t"
3535                        "movzwl %3, %1\n\t"   3535                        "movzwl %3, %1\n\t"
3536                        "andl $0xf3ff, %1\n\t"   3536                        "andl $0xf3ff, %1\n\t"
3537                        "orl $0x0800, %1\n\t"   3537                        "orl $0x0800, %1\n\t"
3538                        "movw %w1, %2\n\t"   3538                        "movw %w1, %2\n\t"
3539                        "fldcw %2\n\t"   3539                        "fldcw %2\n\t"
3540                        "frndint\n\t"   3540                        "frndint\n\t"
3541                        "fldcw %3": "=t" (__value), "=&q" (__ignore),   3541                        "fldcw %3": "=t" (__value), "=&q" (__ignore),
3542                        "=m" (__cwtmp), "=m" (__cw): "0" (__x));   3542                        "=m" (__cwtmp), "=m" (__cw): "0" (__x));
3543   return (__value);   3543   return (__value);
3544 }   3544 }
3545 }   3545 }
3546 __inline extern  __attribute__((__nothrow__)) long lrintf(float __x ) ;   3546 __inline extern  __attribute__((__nothrow__)) long lrintf(float __x ) ;
3547 __inline extern long lrintf(float __x )   3547 __inline extern long lrintf(float __x )
3548 {   3548 {
3549   long __lrintres ;   3549   long __lrintres ;
3550     3550  
3551   {   3551   {
3552   __asm__  volatile   ("fistpl %0": "=m" (__lrintres): "t" (__x): "st");   3552   __asm__  volatile   ("fistpl %0": "=m" (__lrintres): "t" (__x): "st");
3553   return (__lrintres);   3553   return (__lrintres);
3554 }   3554 }
3555 }   3555 }
3556 __inline extern  __attribute__((__nothrow__)) long lrint(double __x ) ;   3556 __inline extern  __attribute__((__nothrow__)) long lrint(double __x ) ;
3557 __inline extern long lrint(double __x )   3557 __inline extern long lrint(double __x )
3558 {   3558 {
3559   long __lrintres ;   3559   long __lrintres ;
3560     3560  
3561   {   3561   {
3562   __asm__  volatile   ("fistpl %0": "=m" (__lrintres): "t" (__x): "st");   3562   __asm__  volatile   ("fistpl %0": "=m" (__lrintres): "t" (__x): "st");
3563   return (__lrintres);   3563   return (__lrintres);
3564 }   3564 }
3565 }   3565 }
3566 __inline extern  __attribute__((__nothrow__)) long lrintl(long double __x ) ;   3566 __inline extern  __attribute__((__nothrow__)) long lrintl(long double __x ) ;
3567 __inline extern long lrintl(long double __x )   3567 __inline extern long lrintl(long double __x )
3568 {   3568 {
3569   long __lrintres ;   3569   long __lrintres ;
3570     3570  
3571   {   3571   {
3572   __asm__  volatile   ("fistpl %0": "=m" (__lrintres): "t" (__x): "st");   3572   __asm__  volatile   ("fistpl %0": "=m" (__lrintres): "t" (__x): "st");
3573   return (__lrintres);   3573   return (__lrintres);
3574 }   3574 }
3575 }   3575 }
3576 __inline extern  __attribute__((__nothrow__)) long long llrintf(float __x ) ;   3576 __inline extern  __attribute__((__nothrow__)) long long llrintf(float __x ) ;
3577 __inline extern long long llrintf(float __x )   3577 __inline extern long long llrintf(float __x )
3578 {   3578 {
3579   long long __llrintres ;   3579   long long __llrintres ;
3580     3580  
3581   {   3581   {
3582   __asm__  volatile   ("fistpll %0": "=m" (__llrintres): "t" (__x): "st");   3582   __asm__  volatile   ("fistpll %0": "=m" (__llrintres): "t" (__x): "st");
3583   return (__llrintres);   3583   return (__llrintres);
3584 }   3584 }
3585 }   3585 }
3586 __inline extern  __attribute__((__nothrow__)) long long llrint(double __x ) ;   3586 __inline extern  __attribute__((__nothrow__)) long long llrint(double __x ) ;
3587 __inline extern long long llrint(double __x )   3587 __inline extern long long llrint(double __x )
3588 {   3588 {
3589   long long __llrintres ;   3589   long long __llrintres ;
3590     3590  
3591   {   3591   {
3592   __asm__  volatile   ("fistpll %0": "=m" (__llrintres): "t" (__x): "st");   3592   __asm__  volatile   ("fistpll %0": "=m" (__llrintres): "t" (__x): "st");
3593   return (__llrintres);   3593   return (__llrintres);
3594 }   3594 }
3595 }   3595 }
3596 __inline extern  __attribute__((__nothrow__)) long long llrintl(long double __x ) ;   3596 __inline extern  __attribute__((__nothrow__)) long long llrintl(long double __x ) ;
3597 __inline extern long long llrintl(long double __x )   3597 __inline extern long long llrintl(long double __x )
3598 {   3598 {
3599   long long __llrintres ;   3599   long long __llrintres ;
3600     3600  
3601   {   3601   {
3602   __asm__  volatile   ("fistpll %0": "=m" (__llrintres): "t" (__x): "st");   3602   __asm__  volatile   ("fistpll %0": "=m" (__llrintres): "t" (__x): "st");
3603   return (__llrintres);   3603   return (__llrintres);
3604 }   3604 }
3605 }   3605 }
3606 __inline extern  __attribute__((__nothrow__)) int __finite(double __x )  __attribute__((__const__)) ;   3606 __inline extern  __attribute__((__nothrow__)) int __finite(double __x )  __attribute__((__const__)) ;
3607 __inline extern int __finite(double __x )   3607 __inline extern int __finite(double __x )
3608 {   3608 {
3609   union __anonunion_52 __constr_expr_0 ;   3609   union __anonunion_52 __constr_expr_0 ;
3610     3610  
3611   {   3611   {
3612   __constr_expr_0.__d = __x;   3612   __constr_expr_0.__d = __x;
3613   return ((int )((((unsigned int )__constr_expr_0.__i[1] | 2148532223U) + 1U) >> 31));   3613   return ((int )((((unsigned int )__constr_expr_0.__i[1] | 2148532223U) + 1U) >> 31));
3614 }   3614 }
3615 }   3615 }
3616 extern  __attribute__((__nothrow__)) unsigned short const   **__ctype_b_loc(void)  __attribute__((__const__)) ;   3616 extern  __attribute__((__nothrow__)) unsigned short const   **__ctype_b_loc(void)  __attribute__((__const__)) ;
3617 extern  __attribute__((__nothrow__)) __int32_t const   **__ctype_tolower_loc(void)  __attribute__((__const__)) ;   3617 extern  __attribute__((__nothrow__)) __int32_t const   **__ctype_tolower_loc(void)  __attribute__((__const__)) ;
3618 extern  __attribute__((__nothrow__)) __int32_t const   **__ctype_toupper_loc(void)  __attribute__((__const__)) ;   3618 extern  __attribute__((__nothrow__)) __int32_t const   **__ctype_toupper_loc(void)  __attribute__((__const__)) ;
3619 extern  __attribute__((__nothrow__)) int isalnum(int  ) ;   3619 extern  __attribute__((__nothrow__)) int isalnum(int  ) ;
3620 extern  __attribute__((__nothrow__)) int isalpha(int  ) ;   3620 extern  __attribute__((__nothrow__)) int isalpha(int  ) ;
3621 extern  __attribute__((__nothrow__)) int iscntrl(int  ) ;   3621 extern  __attribute__((__nothrow__)) int iscntrl(int  ) ;
3622 extern  __attribute__((__nothrow__)) int isdigit(int  ) ;   3622 extern  __attribute__((__nothrow__)) int isdigit(int  ) ;
3623 extern  __attribute__((__nothrow__)) int islower(int  ) ;   3623 extern  __attribute__((__nothrow__)) int islower(int  ) ;
3624 extern  __attribute__((__nothrow__)) int isgraph(int  ) ;   3624 extern  __attribute__((__nothrow__)) int isgraph(int  ) ;
3625 extern  __attribute__((__nothrow__)) int isprint(int  ) ;   3625 extern  __attribute__((__nothrow__)) int isprint(int  ) ;
3626 extern  __attribute__((__nothrow__)) int ispunct(int  ) ;   3626 extern  __attribute__((__nothrow__)) int ispunct(int  ) ;
3627 extern  __attribute__((__nothrow__)) int isspace(int  ) ;   3627 extern  __attribute__((__nothrow__)) int isspace(int  ) ;
3628 extern  __attribute__((__nothrow__)) int isupper(int  ) ;   3628 extern  __attribute__((__nothrow__)) int isupper(int  ) ;
3629 extern  __attribute__((__nothrow__)) int isxdigit(int  ) ;   3629 extern  __attribute__((__nothrow__)) int isxdigit(int  ) ;
3630 __inline extern  __attribute__((__nothrow__)) int tolower(int __c ) ;   3630 __inline extern  __attribute__((__nothrow__)) int tolower(int __c ) ;
3631 __inline extern  __attribute__((__nothrow__)) int toupper(int __c ) ;   3631 __inline extern  __attribute__((__nothrow__)) int toupper(int __c ) ;
3632 extern  __attribute__((__nothrow__)) int isblank(int  ) ;   3632 extern  __attribute__((__nothrow__)) int isblank(int  ) ;
3633 extern  __attribute__((__nothrow__)) int isascii(int __c ) ;   3633 extern  __attribute__((__nothrow__)) int isascii(int __c ) ;
3634 extern  __attribute__((__nothrow__)) int toascii(int __c ) ;   3634 extern  __attribute__((__nothrow__)) int toascii(int __c ) ;
3635 extern  __attribute__((__nothrow__)) int _toupper(int  ) ;   3635 extern  __attribute__((__nothrow__)) int _toupper(int  ) ;
3636 extern  __attribute__((__nothrow__)) int _tolower(int  ) ;   3636 extern  __attribute__((__nothrow__)) int _tolower(int  ) ;
3637 __inline extern  __attribute__((__nothrow__)) int tolower(int __c ) ;   3637 __inline extern  __attribute__((__nothrow__)) int tolower(int __c ) ;
3638 __inline extern int tolower(int __c )   3638 __inline extern int tolower(int __c )
3639 {   3639 {
3640   __int32_t const   **tmp ;   3640   __int32_t const   **tmp ;
3641   __int32_t tmp___0 ;   3641   __int32_t tmp___0 ;
3642     3642  
3643   {   3643   {
3644   if (__c >= -128) {   3644   if (__c >= -128) {
3645     if (__c < 256) {   3645     if (__c < 256) {
3646       tmp = __ctype_tolower_loc();   3646       tmp = __ctype_tolower_loc();
3647       tmp___0 = *(*tmp + __c);   3647       tmp___0 = *(*tmp + __c);
3648     } else {   3648     } else {
3649       tmp___0 = (__int32_t const   )__c;   3649       tmp___0 = (__int32_t const   )__c;
3650     }   3650     }
3651   } else {   3651   } else {
3652     tmp___0 = (__int32_t const   )__c;   3652     tmp___0 = (__int32_t const   )__c;
3653   }   3653   }
3654   return ((int )tmp___0);   3654   return ((int )tmp___0);
3655 }   3655 }
3656 }   3656 }
3657 __inline extern  __attribute__((__nothrow__)) int toupper(int __c ) ;   3657 __inline extern  __attribute__((__nothrow__)) int toupper(int __c ) ;
3658 __inline extern int toupper(int __c )   3658 __inline extern int toupper(int __c )
3659 {   3659 {
3660   __int32_t const   **tmp ;   3660   __int32_t const   **tmp ;
3661   __int32_t tmp___0 ;   3661   __int32_t tmp___0 ;
3662     3662  
3663   {   3663   {
3664   if (__c >= -128) {   3664   if (__c >= -128) {
3665     if (__c < 256) {   3665     if (__c < 256) {
3666       tmp = __ctype_toupper_loc();   3666       tmp = __ctype_toupper_loc();
3667       tmp___0 = *(*tmp + __c);   3667       tmp___0 = *(*tmp + __c);
3668     } else {   3668     } else {
3669       tmp___0 = (__int32_t const   )__c;   3669       tmp___0 = (__int32_t const   )__c;
3670     }   3670     }
3671   } else {   3671   } else {
3672     tmp___0 = (__int32_t const   )__c;   3672     tmp___0 = (__int32_t const   )__c;
3673   }   3673   }
3674   return ((int )tmp___0);   3674   return ((int )tmp___0);
3675 }   3675 }
3676 }   3676 }
3677 extern  __attribute__((__nothrow__)) int isalnum_l(int  , __locale_t  ) ;   3677 extern  __attribute__((__nothrow__)) int isalnum_l(int  , __locale_t  ) ;
3678 extern  __attribute__((__nothrow__)) int isalpha_l(int  , __locale_t  ) ;   3678 extern  __attribute__((__nothrow__)) int isalpha_l(int  , __locale_t  ) ;
3679 extern  __attribute__((__nothrow__)) int iscntrl_l(int  , __locale_t  ) ;   3679 extern  __attribute__((__nothrow__)) int iscntrl_l(int  , __locale_t  ) ;
3680 extern  __attribute__((__nothrow__)) int isdigit_l(int  , __locale_t  ) ;   3680 extern  __attribute__((__nothrow__)) int isdigit_l(int  , __locale_t  ) ;
3681 extern  __attribute__((__nothrow__)) int islower_l(int  , __locale_t  ) ;   3681 extern  __attribute__((__nothrow__)) int islower_l(int  , __locale_t  ) ;
3682 extern  __attribute__((__nothrow__)) int isgraph_l(int  , __locale_t  ) ;   3682 extern  __attribute__((__nothrow__)) int isgraph_l(int  , __locale_t  ) ;
3683 extern  __attribute__((__nothrow__)) int isprint_l(int  , __locale_t  ) ;   3683 extern  __attribute__((__nothrow__)) int isprint_l(int  , __locale_t  ) ;
3684 extern  __attribute__((__nothrow__)) int ispunct_l(int  , __locale_t  ) ;   3684 extern  __attribute__((__nothrow__)) int ispunct_l(int  , __locale_t  ) ;
3685 extern  __attribute__((__nothrow__)) int isspace_l(int  , __locale_t  ) ;   3685 extern  __attribute__((__nothrow__)) int isspace_l(int  , __locale_t  ) ;
3686 extern  __attribute__((__nothrow__)) int isupper_l(int  , __locale_t  ) ;   3686 extern  __attribute__((__nothrow__)) int isupper_l(int  , __locale_t  ) ;
3687 extern  __attribute__((__nothrow__)) int isxdigit_l(int  , __locale_t  ) ;   3687 extern  __attribute__((__nothrow__)) int isxdigit_l(int  , __locale_t  ) ;
3688 extern  __attribute__((__nothrow__)) int isblank_l(int  , __locale_t  ) ;   3688 extern  __attribute__((__nothrow__)) int isblank_l(int  , __locale_t  ) ;
3689 extern  __attribute__((__nothrow__)) int __tolower_l(int __c , __locale_t __l ) ;   3689 extern  __attribute__((__nothrow__)) int __tolower_l(int __c , __locale_t __l ) ;
3690 extern  __attribute__((__nothrow__)) int tolower_l(int __c , __locale_t __l ) ;   3690 extern  __attribute__((__nothrow__)) int tolower_l(int __c , __locale_t __l ) ;
3691 extern  __attribute__((__nothrow__)) int __toupper_l(int __c , __locale_t __l ) ;   3691 extern  __attribute__((__nothrow__)) int __toupper_l(int __c , __locale_t __l ) ;
3692 extern  __attribute__((__nothrow__)) int toupper_l(int __c , __locale_t __l ) ;   3692 extern  __attribute__((__nothrow__)) int toupper_l(int __c , __locale_t __l ) ;
3693 __inline extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) stat)(char const   * __restrict  __path ,   3693 __inline extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) stat)(char const   * __restrict  __path ,
3694                                                                                             struct stat * __restrict  __statbuf )  __asm__("stat64")  ;   3694                                                                                             struct stat * __restrict  __statbuf )  __asm__("stat64")  ;
3695 __inline extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) fstat)(int __fd ,   3695 __inline extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) fstat)(int __fd ,
3696                                                                                            struct stat *__statbuf )  __asm__("fstat64")  ;   3696                                                                                            struct stat *__statbuf )  __asm__("fstat64")  ;
3697 __inline extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2,3))) fstatat)(int __fd ,   3697 __inline extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2,3))) fstatat)(int __fd ,
3698                                                                                                char const   * __restrict  __filename ,   3698                                                                                                char const   * __restrict  __filename ,
3699                                                                                                struct stat * __restrict  __statbuf ,   3699                                                                                                struct stat * __restrict  __statbuf ,
3700                                                                                                int __flag )  __asm__("fstatat64")  ;   3700                                                                                                int __flag )  __asm__("fstatat64")  ;
3701 __inline extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) lstat)(char const   * __restrict  __path ,   3701 __inline extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) lstat)(char const   * __restrict  __path ,
3702                                                                                              struct stat * __restrict  __statbuf )  __asm__("lstat64")  ;   3702                                                                                              struct stat * __restrict  __statbuf )  __asm__("lstat64")  ;
3703 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) chmod)(char const   *__file ,   3703 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) chmod)(char const   *__file ,
3704                                                                                   __mode_t __mode ) ;   3704                                                                                   __mode_t __mode ) ;
3705 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) lchmod)(char const   *__file ,   3705 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) lchmod)(char const   *__file ,
3706                                                                                    __mode_t __mode ) ;   3706                                                                                    __mode_t __mode ) ;
3707 extern  __attribute__((__nothrow__)) int fchmod(int __fd , __mode_t __mode ) ;   3707 extern  __attribute__((__nothrow__)) int fchmod(int __fd , __mode_t __mode ) ;
3708 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) fchmodat)(int __fd ,   3708 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) fchmodat)(int __fd ,
3709                                                                                      char const   *__file ,   3709                                                                                      char const   *__file ,
3710                                                                                      __mode_t __mode ,   3710                                                                                      __mode_t __mode ,
3711                                                                                      int __flag ) ;   3711                                                                                      int __flag ) ;
3712 extern  __attribute__((__nothrow__)) __mode_t umask(__mode_t __mask ) ;   3712 extern  __attribute__((__nothrow__)) __mode_t umask(__mode_t __mask ) ;
3713 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) mkdir)(char const   *__path ,   3713 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) mkdir)(char const   *__path ,
3714                                                                                   __mode_t __mode ) ;   3714                                                                                   __mode_t __mode ) ;
3715 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) mkdirat)(int __fd ,   3715 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) mkdirat)(int __fd ,
3716                                                                                     char const   *__path ,   3716                                                                                     char const   *__path ,
3717                                                                                     __mode_t __mode ) ;   3717                                                                                     __mode_t __mode ) ;
3718 __inline extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) mknod)(char const   *__path ,   3718 __inline extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) mknod)(char const   *__path ,
3719                                                                                            __mode_t __mode ,   3719                                                                                            __mode_t __mode ,
3720                                                                                            __dev_t __dev ) ;   3720                                                                                            __dev_t __dev ) ;
3721 __inline extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) mknodat)(int __fd ,   3721 __inline extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) mknodat)(int __fd ,
3722                                                                                              char const   *__path ,   3722                                                                                              char const   *__path ,
3723                                                                                              __mode_t __mode ,   3723                                                                                              __mode_t __mode ,
3724                                                                                              __dev_t __dev ) ;   3724                                                                                              __dev_t __dev ) ;
3725 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) mkfifo)(char const   *__path ,   3725 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) mkfifo)(char const   *__path ,
3726                                                                                    __mode_t __mode ) ;   3726                                                                                    __mode_t __mode ) ;
3727 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) mkfifoat)(int __fd ,   3727 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) mkfifoat)(int __fd ,
3728                                                                                      char const   *__path ,   3728                                                                                      char const   *__path ,
3729                                                                                      __mode_t __mode ) ;   3729                                                                                      __mode_t __mode ) ;
3730 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) utimensat)(int __fd ,   3730 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) utimensat)(int __fd ,
3731                                                                                       char const   *__path ,   3731                                                                                       char const   *__path ,
3732                                                                                       struct timespec  const  *__times ,   3732                                                                                       struct timespec  const  *__times ,
3733                                                                                       int __flags ) ;   3733                                                                                       int __flags ) ;
3734 extern  __attribute__((__nothrow__)) int futimens(int __fd ,   3734 extern  __attribute__((__nothrow__)) int futimens(int __fd ,
3735                                                   struct timespec  const  *__times ) ;   3735                                                   struct timespec  const  *__times ) ;
3736 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(3))) __fxstat)(int __ver ,   3736 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(3))) __fxstat)(int __ver ,
3737                                                                                      int __fildes ,   3737                                                                                      int __fildes ,
3738                                                                                      struct stat *__stat_buf )  __asm__("__fxstat64")  ;   3738                                                                                      struct stat *__stat_buf )  __asm__("__fxstat64")  ;
3739 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2,3))) __xstat)(int __ver ,   3739 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2,3))) __xstat)(int __ver ,
3740                                                                                       char const   *__filename ,   3740                                                                                       char const   *__filename ,
3741                                                                                       struct stat *__stat_buf )  __asm__("__xstat64")  ;   3741                                                                                       struct stat *__stat_buf )  __asm__("__xstat64")  ;
3742 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2,3))) __lxstat)(int __ver ,   3742 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2,3))) __lxstat)(int __ver ,
3743                                                                                        char const   *__filename ,   3743                                                                                        char const   *__filename ,
3744                                                                                        struct stat *__stat_buf )  __asm__("__lxstat64")  ;   3744                                                                                        struct stat *__stat_buf )  __asm__("__lxstat64")  ;
3745 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(3,4))) __fxstatat)(int __ver ,   3745 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(3,4))) __fxstatat)(int __ver ,
3746                                                                                          int __fildes ,   3746                                                                                          int __fildes ,
3747                                                                                          char const   *__filename ,   3747                                                                                          char const   *__filename ,
3748                                                                                          struct stat *__stat_buf ,   3748                                                                                          struct stat *__stat_buf ,
3749                                                                                          int __flag )  __asm__("__fxstatat64")  ;   3749                                                                                          int __flag )  __asm__("__fxstatat64")  ;
3750 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2,4))) __xmknod)(int __ver ,   3750 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2,4))) __xmknod)(int __ver ,
3751                                                                                        char const   *__path ,   3751                                                                                        char const   *__path ,
3752                                                                                        __mode_t __mode ,   3752                                                                                        __mode_t __mode ,
3753                                                                                        __dev_t *__dev ) ;   3753                                                                                        __dev_t *__dev ) ;
3754 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(3,5))) __xmknodat)(int __ver ,   3754 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(3,5))) __xmknodat)(int __ver ,
3755                                                                                          int __fd ,   3755                                                                                          int __fd ,
3756                                                                                          char const   *__path ,   3756                                                                                          char const   *__path ,
3757                                                                                          __mode_t __mode ,   3757                                                                                          __mode_t __mode ,
3758                                                                                          __dev_t *__dev ) ;   3758                                                                                          __dev_t *__dev ) ;
3759 __inline extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) stat)(char const   * __restrict  __path ,   3759 __inline extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) stat)(char const   * __restrict  __path ,
3760                                                                                             struct stat * __restrict  __statbuf )  __asm__("stat64")  ;   3760                                                                                             struct stat * __restrict  __statbuf )  __asm__("stat64")  ;
3761 __inline extern int ( __attribute__((__nonnull__(1,2))) stat)(char const   * __restrict  __path ,   3761 __inline extern int ( __attribute__((__nonnull__(1,2))) stat)(char const   * __restrict  __path ,
3762                                                               struct stat * __restrict  __statbuf )   3762                                                               struct stat * __restrict  __statbuf )
3763 {   3763 {
3764   int tmp ;   3764   int tmp ;
3765     3765  
3766   {   3766   {
3767   tmp = __xstat(3, (char const   *)__path, (struct stat *)__statbuf);   3767   tmp = __xstat(3, (char const   *)__path, (struct stat *)__statbuf);
3768   return (tmp);   3768   return (tmp);
3769 }   3769 }
3770 }   3770 }
3771 __inline extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) lstat)(char const   * __restrict  __path ,   3771 __inline extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) lstat)(char const   * __restrict  __path ,
3772                                                                                              struct stat * __restrict  __statbuf )  __asm__("lstat64")  ;   3772                                                                                              struct stat * __restrict  __statbuf )  __asm__("lstat64")  ;
3773 __inline extern int ( __attribute__((__nonnull__(1,2))) lstat)(char const   * __restrict  __path ,   3773 __inline extern int ( __attribute__((__nonnull__(1,2))) lstat)(char const   * __restrict  __path ,
3774                                                                struct stat * __restrict  __statbuf )   3774                                                                struct stat * __restrict  __statbuf )
3775 {   3775 {
3776   int tmp ;   3776   int tmp ;
3777     3777  
3778   {   3778   {
3779   tmp = __lxstat(3, (char const   *)__path, (struct stat *)__statbuf);   3779   tmp = __lxstat(3, (char const   *)__path, (struct stat *)__statbuf);
3780   return (tmp);   3780   return (tmp);
3781 }   3781 }
3782 }   3782 }
3783 __inline extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) fstat)(int __fd ,   3783 __inline extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) fstat)(int __fd ,
3784                                                                                            struct stat *__statbuf )  __asm__("fstat64")  ;   3784                                                                                            struct stat *__statbuf )  __asm__("fstat64")  ;
3785 __inline extern int ( __attribute__((__nonnull__(2))) fstat)(int __fd ,   3785 __inline extern int ( __attribute__((__nonnull__(2))) fstat)(int __fd ,
3786                                                              struct stat *__statbuf )   3786                                                              struct stat *__statbuf )
3787 {   3787 {
3788   int tmp ;   3788   int tmp ;
3789     3789  
3790   {   3790   {
3791   tmp = __fxstat(3, __fd, __statbuf);   3791   tmp = __fxstat(3, __fd, __statbuf);
3792   return (tmp);   3792   return (tmp);
3793 }   3793 }
3794 }   3794 }
3795 __inline extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2,3))) fstatat)(int __fd ,   3795 __inline extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2,3))) fstatat)(int __fd ,
3796                                                                                                char const   * __restrict  __filename ,   3796                                                                                                char const   * __restrict  __filename ,
3797                                                                                                struct stat * __restrict  __statbuf ,   3797                                                                                                struct stat * __restrict  __statbuf ,
3798                                                                                                int __flag )  __asm__("fstatat64")  ;   3798                                                                                                int __flag )  __asm__("fstatat64")  ;
3799 __inline extern int ( __attribute__((__nonnull__(2,3))) fstatat)(int __fd ,   3799 __inline extern int ( __attribute__((__nonnull__(2,3))) fstatat)(int __fd ,
3800                                                                  char const   * __restrict  __filename ,   3800                                                                  char const   * __restrict  __filename ,
3801                                                                  struct stat * __restrict  __statbuf ,   3801                                                                  struct stat * __restrict  __statbuf ,
3802                                                                  int __flag )   3802                                                                  int __flag )
3803 {   3803 {
3804   int tmp ;   3804   int tmp ;
3805     3805  
3806   {   3806   {
3807   tmp = __fxstatat(3, __fd, (char const   *)__filename,   3807   tmp = __fxstatat(3, __fd, (char const   *)__filename,
3808                    (struct stat *)__statbuf, __flag);   3808                    (struct stat *)__statbuf, __flag);
3809   return (tmp);   3809   return (tmp);
3810 }   3810 }
3811 }   3811 }
3812 __inline extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) mknod)(char const   *__path ,   3812 __inline extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) mknod)(char const   *__path ,
3813                                                                                            __mode_t __mode ,   3813                                                                                            __mode_t __mode ,
3814                                                                                            __dev_t __dev ) ;   3814                                                                                            __dev_t __dev ) ;
3815 __inline extern int ( __attribute__((__nonnull__(1))) mknod)(char const   *__path ,   3815 __inline extern int ( __attribute__((__nonnull__(1))) mknod)(char const   *__path ,
3816                                                              __mode_t __mode ,   3816                                                              __mode_t __mode ,
3817                                                              __dev_t __dev )   3817                                                              __dev_t __dev )
3818 {   3818 {
3819   int tmp ;   3819   int tmp ;
3820     3820  
3821   {   3821   {
3822   tmp = __xmknod(1, __path, __mode, & __dev);   3822   tmp = __xmknod(1, __path, __mode, & __dev);
3823   return (tmp);   3823   return (tmp);
3824 }   3824 }
3825 }   3825 }
3826 __inline extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) mknodat)(int __fd ,   3826 __inline extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) mknodat)(int __fd ,
3827                                                                                              char const   *__path ,   3827                                                                                              char const   *__path ,
3828                                                                                              __mode_t __mode ,   3828                                                                                              __mode_t __mode ,
3829                                                                                              __dev_t __dev ) ;   3829                                                                                              __dev_t __dev ) ;
3830 __inline extern int ( __attribute__((__nonnull__(2))) mknodat)(int __fd ,   3830 __inline extern int ( __attribute__((__nonnull__(2))) mknodat)(int __fd ,
3831                                                                char const   *__path ,   3831                                                                char const   *__path ,
3832                                                                __mode_t __mode ,   3832                                                                __mode_t __mode ,
3833                                                                __dev_t __dev )   3833                                                                __dev_t __dev )
3834 {   3834 {
3835   int tmp ;   3835   int tmp ;
3836     3836  
3837   {   3837   {
3838   tmp = __xmknodat(1, __fd, __path, __mode, & __dev);   3838   tmp = __xmknodat(1, __fd, __path, __mode, & __dev);
3839   return (tmp);   3839   return (tmp);
3840 }   3840 }
3841 }   3841 }
3842 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) access)(char const   *__name ,   3842 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) access)(char const   *__name ,
3843                                                                                    int __type ) ;   3843                                                                                    int __type ) ;
3844 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) faccessat)(int __fd ,   3844 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) faccessat)(int __fd ,
3845                                                                                       char const   *__file ,   3845                                                                                       char const   *__file ,
3846                                                                                       int __type ,   3846                                                                                       int __type ,
3847                                                                                       int __flag ) ;   3847                                                                                       int __flag ) ;
3848 extern  __attribute__((__nothrow__)) __off64_t lseek(int __fd ,   3848 extern  __attribute__((__nothrow__)) __off64_t lseek(int __fd ,
3849                                                      __off64_t __offset ,   3849                                                      __off64_t __offset ,
3850                                                      int __whence )  __asm__("lseek64")  ;   3850                                                      int __whence )  __asm__("lseek64")  ;
3851 extern int close(int __fd ) ;   3851 extern int close(int __fd ) ;
3852 extern ssize_t read(int __fd , void *__buf , size_t __nbytes ) ;   3852 extern ssize_t read(int __fd , void *__buf , size_t __nbytes ) ;
3853 extern ssize_t write(int __fd , void const   *__buf , size_t __n ) ;   3853 extern ssize_t write(int __fd , void const   *__buf , size_t __n ) ;
3854 extern ssize_t pread(int __fd , void *__buf , size_t __nbytes ,   3854 extern ssize_t pread(int __fd , void *__buf , size_t __nbytes ,
3855                      __off64_t __offset )  __asm__("pread64")  ;   3855                      __off64_t __offset )  __asm__("pread64")  ;
3856 extern ssize_t pwrite(int __fd , void const   *__buf , size_t __nbytes ,   3856 extern ssize_t pwrite(int __fd , void const   *__buf , size_t __nbytes ,
3857                       __off64_t __offset )  __asm__("pwrite64")  ;   3857                       __off64_t __offset )  __asm__("pwrite64")  ;
3858 extern  __attribute__((__nothrow__)) int pipe(int *__pipedes ) ;   3858 extern  __attribute__((__nothrow__)) int pipe(int *__pipedes ) ;
3859 extern  __attribute__((__nothrow__)) unsigned int alarm(unsigned int __seconds ) ;   3859 extern  __attribute__((__nothrow__)) unsigned int alarm(unsigned int __seconds ) ;
3860 extern unsigned int sleep(unsigned int __seconds ) ;   3860 extern unsigned int sleep(unsigned int __seconds ) ;
3861 extern  __attribute__((__nothrow__)) __useconds_t ualarm(__useconds_t __value ,   3861 extern  __attribute__((__nothrow__)) __useconds_t ualarm(__useconds_t __value ,
3862                                                          __useconds_t __interval ) ;   3862                                                          __useconds_t __interval ) ;
3863 extern int usleep(__useconds_t __useconds ) ;   3863 extern int usleep(__useconds_t __useconds ) ;
3864 extern int pause(void) ;   3864 extern int pause(void) ;
3865 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) chown)(char const   *__file ,   3865 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) chown)(char const   *__file ,
3866                                                                                   __uid_t __owner ,   3866                                                                                   __uid_t __owner ,
3867                                                                                   __gid_t __group ) ;   3867                                                                                   __gid_t __group ) ;
3868 extern  __attribute__((__nothrow__)) int fchown(int __fd , __uid_t __owner ,   3868 extern  __attribute__((__nothrow__)) int fchown(int __fd , __uid_t __owner ,
3869                                                 __gid_t __group ) ;   3869                                                 __gid_t __group ) ;
3870 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) lchown)(char const   *__file ,   3870 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) lchown)(char const   *__file ,
3871                                                                                    __uid_t __owner ,   3871                                                                                    __uid_t __owner ,
3872                                                                                    __gid_t __group ) ;   3872                                                                                    __gid_t __group ) ;
3873 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) fchownat)(int __fd ,   3873 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) fchownat)(int __fd ,
3874                                                                                      char const   *__file ,   3874                                                                                      char const   *__file ,
3875                                                                                      __uid_t __owner ,   3875                                                                                      __uid_t __owner ,
3876                                                                                      __gid_t __group ,   3876                                                                                      __gid_t __group ,
3877                                                                                      int __flag ) ;   3877                                                                                      int __flag ) ;
3878 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) chdir)(char const   *__path ) ;   3878 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) chdir)(char const   *__path ) ;
3879 extern  __attribute__((__nothrow__)) int fchdir(int __fd ) ;   3879 extern  __attribute__((__nothrow__)) int fchdir(int __fd ) ;
3880 extern  __attribute__((__nothrow__)) char *getcwd(char *__buf , size_t __size ) ;   3880 extern  __attribute__((__nothrow__)) char *getcwd(char *__buf , size_t __size ) ;
3881 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1))) getwd)(char *__buf )  __attribute__((__deprecated__)) ;   3881 extern  __attribute__((__nothrow__)) char *( __attribute__((__nonnull__(1))) getwd)(char *__buf )  __attribute__((__deprecated__)) ;
3882 extern  __attribute__((__nothrow__)) int dup(int __fd ) ;   3882 extern  __attribute__((__nothrow__)) int dup(int __fd ) ;
3883 extern  __attribute__((__nothrow__)) int dup2(int __fd , int __fd2 ) ;   3883 extern  __attribute__((__nothrow__)) int dup2(int __fd , int __fd2 ) ;
3884 extern char **__environ ;   3884 extern char **__environ ;
3885 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) execve)(char const   *__path ,   3885 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) execve)(char const   *__path ,
3886                                                                                      char * const  *__argv ,   3886                                                                                      char * const  *__argv ,
3887                                                                                      char * const  *__envp ) ;   3887                                                                                      char * const  *__envp ) ;
3888 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) fexecve)(int __fd ,   3888 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) fexecve)(int __fd ,
3889                                                                                     char * const  *__argv ,   3889                                                                                     char * const  *__argv ,
3890                                                                                     char * const  *__envp ) ;   3890                                                                                     char * const  *__envp ) ;
3891 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) execv)(char const   *__path ,   3891 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) execv)(char const   *__path ,
3892                                                                                     char * const  *__argv ) ;   3892                                                                                     char * const  *__argv ) ;
3893 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) execle)(char const   *__path ,   3893 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) execle)(char const   *__path ,
3894                                                                                      char const   *__arg   3894                                                                                      char const   *__arg
3895                                                                                      , ...) ;   3895                                                                                      , ...) ;
3896 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) execl)(char const   *__path ,   3896 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) execl)(char const   *__path ,
3897                                                                                     char const   *__arg   3897                                                                                     char const   *__arg
3898                                                                                     , ...) ;   3898                                                                                     , ...) ;
3899 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) execvp)(char const   *__file ,   3899 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) execvp)(char const   *__file ,
3900                                                                                      char * const  *__argv ) ;   3900                                                                                      char * const  *__argv ) ;
3901 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) execlp)(char const   *__file ,   3901 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) execlp)(char const   *__file ,
3902                                                                                      char const   *__arg   3902                                                                                      char const   *__arg
3903                                                                                      , ...) ;   3903                                                                                      , ...) ;
3904 extern  __attribute__((__nothrow__)) int nice(int __inc ) ;   3904 extern  __attribute__((__nothrow__)) int nice(int __inc ) ;
3905 extern  __attribute__((__noreturn__)) void _exit(int __status ) ;   3905 extern  __attribute__((__noreturn__)) void _exit(int __status ) ;
3906 extern  __attribute__((__nothrow__)) long ( __attribute__((__nonnull__(1))) pathconf)(char const   *__path ,   3906 extern  __attribute__((__nothrow__)) long ( __attribute__((__nonnull__(1))) pathconf)(char const   *__path ,
3907                                                                                       int __name ) ;   3907                                                                                       int __name ) ;
3908 extern  __attribute__((__nothrow__)) long fpathconf(int __fd , int __name ) ;   3908 extern  __attribute__((__nothrow__)) long fpathconf(int __fd , int __name ) ;
3909 extern  __attribute__((__nothrow__)) long sysconf(int __name ) ;   3909 extern  __attribute__((__nothrow__)) long sysconf(int __name ) ;
3910 extern  __attribute__((__nothrow__)) size_t confstr(int __name , char *__buf ,   3910 extern  __attribute__((__nothrow__)) size_t confstr(int __name , char *__buf ,
3911                                                     size_t __len ) ;   3911                                                     size_t __len ) ;
3912 extern  __attribute__((__nothrow__)) __pid_t getpid(void) ;   3912 extern  __attribute__((__nothrow__)) __pid_t getpid(void) ;
3913 extern  __attribute__((__nothrow__)) __pid_t getppid(void) ;   3913 extern  __attribute__((__nothrow__)) __pid_t getppid(void) ;
3914 extern  __attribute__((__nothrow__)) __pid_t getpgrp(void) ;   3914 extern  __attribute__((__nothrow__)) __pid_t getpgrp(void) ;
3915 extern  __attribute__((__nothrow__)) __pid_t __getpgid(__pid_t __pid ) ;   3915 extern  __attribute__((__nothrow__)) __pid_t __getpgid(__pid_t __pid ) ;
3916 extern  __attribute__((__nothrow__)) __pid_t getpgid(__pid_t __pid ) ;   3916 extern  __attribute__((__nothrow__)) __pid_t getpgid(__pid_t __pid ) ;
3917 extern  __attribute__((__nothrow__)) int setpgid(__pid_t __pid , __pid_t __pgid ) ;   3917 extern  __attribute__((__nothrow__)) int setpgid(__pid_t __pid , __pid_t __pgid ) ;
3918 extern  __attribute__((__nothrow__)) int setpgrp(void) ;   3918 extern  __attribute__((__nothrow__)) int setpgrp(void) ;
3919 extern  __attribute__((__nothrow__)) __pid_t setsid(void) ;   3919 extern  __attribute__((__nothrow__)) __pid_t setsid(void) ;
3920 extern  __attribute__((__nothrow__)) __pid_t getsid(__pid_t __pid ) ;   3920 extern  __attribute__((__nothrow__)) __pid_t getsid(__pid_t __pid ) ;
3921 extern  __attribute__((__nothrow__)) __uid_t getuid(void) ;   3921 extern  __attribute__((__nothrow__)) __uid_t getuid(void) ;
3922 extern  __attribute__((__nothrow__)) __uid_t geteuid(void) ;   3922 extern  __attribute__((__nothrow__)) __uid_t geteuid(void) ;
3923 extern  __attribute__((__nothrow__)) __gid_t getgid(void) ;   3923 extern  __attribute__((__nothrow__)) __gid_t getgid(void) ;
3924 extern  __attribute__((__nothrow__)) __gid_t getegid(void) ;   3924 extern  __attribute__((__nothrow__)) __gid_t getegid(void) ;
3925 extern  __attribute__((__nothrow__)) int getgroups(int __size , __gid_t *__list ) ;   3925 extern  __attribute__((__nothrow__)) int getgroups(int __size , __gid_t *__list ) ;
3926 extern  __attribute__((__nothrow__)) int setuid(__uid_t __uid ) ;   3926 extern  __attribute__((__nothrow__)) int setuid(__uid_t __uid ) ;
3927 extern  __attribute__((__nothrow__)) int setreuid(__uid_t __ruid ,   3927 extern  __attribute__((__nothrow__)) int setreuid(__uid_t __ruid ,
3928                                                   __uid_t __euid ) ;   3928                                                   __uid_t __euid ) ;
3929 extern  __attribute__((__nothrow__)) int seteuid(__uid_t __uid ) ;   3929 extern  __attribute__((__nothrow__)) int seteuid(__uid_t __uid ) ;
3930 extern  __attribute__((__nothrow__)) int setgid(__gid_t __gid ) ;   3930 extern  __attribute__((__nothrow__)) int setgid(__gid_t __gid ) ;
3931 extern  __attribute__((__nothrow__)) int setregid(__gid_t __rgid ,   3931 extern  __attribute__((__nothrow__)) int setregid(__gid_t __rgid ,
3932                                                   __gid_t __egid ) ;   3932                                                   __gid_t __egid ) ;
3933 extern  __attribute__((__nothrow__)) int setegid(__gid_t __gid ) ;   3933 extern  __attribute__((__nothrow__)) int setegid(__gid_t __gid ) ;
3934 extern  __attribute__((__nothrow__)) __pid_t fork(void) ;   3934 extern  __attribute__((__nothrow__)) __pid_t fork(void) ;
3935 extern  __attribute__((__nothrow__)) __pid_t vfork(void) ;   3935 extern  __attribute__((__nothrow__)) __pid_t vfork(void) ;
3936 extern  __attribute__((__nothrow__)) char *ttyname(int __fd ) ;   3936 extern  __attribute__((__nothrow__)) char *ttyname(int __fd ) ;
3937 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) ttyname_r)(int __fd ,   3937 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) ttyname_r)(int __fd ,
3938                                                                                       char *__buf ,   3938                                                                                       char *__buf ,
3939                                                                                       size_t __buflen ) ;   3939                                                                                       size_t __buflen ) ;
3940 extern  __attribute__((__nothrow__)) int isatty(int __fd ) ;   3940 extern  __attribute__((__nothrow__)) int isatty(int __fd ) ;
3941 extern  __attribute__((__nothrow__)) int ttyslot(void) ;   3941 extern  __attribute__((__nothrow__)) int ttyslot(void) ;
3942 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) link)(char const   *__from ,   3942 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) link)(char const   *__from ,
3943                                                                                    char const   *__to ) ;   3943                                                                                    char const   *__to ) ;
3944 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2,4))) linkat)(int __fromfd ,   3944 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2,4))) linkat)(int __fromfd ,
3945                                                                                      char const   *__from ,   3945                                                                                      char const   *__from ,
3946                                                                                      int __tofd ,   3946                                                                                      int __tofd ,
3947                                                                                      char const   *__to ,   3947                                                                                      char const   *__to ,
3948                                                                                      int __flags ) ;   3948                                                                                      int __flags ) ;
3949 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) symlink)(char const   *__from ,   3949 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,2))) symlink)(char const   *__from ,
3950                                                                                       char const   *__to ) ;   3950                                                                                       char const   *__to ) ;
3951 extern  __attribute__((__nothrow__)) ssize_t ( __attribute__((__nonnull__(1,2))) readlink)(char const   * __restrict  __path ,   3951 extern  __attribute__((__nothrow__)) ssize_t ( __attribute__((__nonnull__(1,2))) readlink)(char const   * __restrict  __path ,
3952                                                                                            char * __restrict  __buf ,   3952                                                                                            char * __restrict  __buf ,
3953                                                                                            size_t __len ) ;   3953                                                                                            size_t __len ) ;
3954 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,3))) symlinkat)(char const   *__from ,   3954 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1,3))) symlinkat)(char const   *__from ,
3955                                                                                         int __tofd ,   3955                                                                                         int __tofd ,
3956                                                                                         char const   *__to ) ;   3956                                                                                         char const   *__to ) ;
3957 extern  __attribute__((__nothrow__)) ssize_t ( __attribute__((__nonnull__(2,3))) readlinkat)(int __fd ,   3957 extern  __attribute__((__nothrow__)) ssize_t ( __attribute__((__nonnull__(2,3))) readlinkat)(int __fd ,
3958                                                                                              char const   * __restrict  __path ,   3958                                                                                              char const   * __restrict  __path ,
3959                                                                                              char * __restrict  __buf ,   3959                                                                                              char * __restrict  __buf ,
3960                                                                                              size_t __len ) ;   3960                                                                                              size_t __len ) ;
3961 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) unlink)(char const   *__name ) ;   3961 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) unlink)(char const   *__name ) ;
3962 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) unlinkat)(int __fd ,   3962 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(2))) unlinkat)(int __fd ,
3963                                                                                      char const   *__name ,   3963                                                                                      char const   *__name ,
3964                                                                                      int __flag ) ;   3964                                                                                      int __flag ) ;
3965 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) rmdir)(char const   *__path ) ;   3965 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) rmdir)(char const   *__path ) ;
3966 extern  __attribute__((__nothrow__)) __pid_t tcgetpgrp(int __fd ) ;   3966 extern  __attribute__((__nothrow__)) __pid_t tcgetpgrp(int __fd ) ;
3967 extern  __attribute__((__nothrow__)) int tcsetpgrp(int __fd , __pid_t __pgrp_id ) ;   3967 extern  __attribute__((__nothrow__)) int tcsetpgrp(int __fd , __pid_t __pgrp_id ) ;
3968 extern char *getlogin(void) ;   3968 extern char *getlogin(void) ;
3969 extern int ( __attribute__((__nonnull__(1))) getlogin_r)(char *__name ,   3969 extern int ( __attribute__((__nonnull__(1))) getlogin_r)(char *__name ,
3970                                                          size_t __name_len ) ;   3970                                                          size_t __name_len ) ;
3971 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) setlogin)(char const   *__name ) ;   3971 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) setlogin)(char const   *__name ) ;
3972 extern char *optarg ;   3972 extern char *optarg ;
3973 extern int optind ;   3973 extern int optind ;
3974 extern int opterr ;   3974 extern int opterr ;
3975 extern int optopt ;   3975 extern int optopt ;
3976 extern  __attribute__((__nothrow__)) int getopt(int ___argc ,   3976 extern  __attribute__((__nothrow__)) int getopt(int ___argc ,
3977                                                 char * const  *___argv ,   3977                                                 char * const  *___argv ,
3978                                                 char const   *__shortopts ) ;   3978                                                 char const   *__shortopts ) ;
3979 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) gethostname)(char *__name ,   3979 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) gethostname)(char *__name ,
3980                                                                                         size_t __len ) ;   3980                                                                                         size_t __len ) ;
3981 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) sethostname)(char const   *__name ,   3981 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) sethostname)(char const   *__name ,
3982                                                                                         size_t __len ) ;   3982                                                                                         size_t __len ) ;
3983 extern  __attribute__((__nothrow__)) int sethostid(long __id ) ;   3983 extern  __attribute__((__nothrow__)) int sethostid(long __id ) ;
3984 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) getdomainname)(char *__name ,   3984 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) getdomainname)(char *__name ,
3985                                                                                           size_t __len ) ;   3985                                                                                           size_t __len ) ;
3986 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) setdomainname)(char const   *__name ,   3986 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) setdomainname)(char const   *__name ,
3987                                                                                           size_t __len ) ;   3987                                                                                           size_t __len ) ;
3988 extern  __attribute__((__nothrow__)) int vhangup(void) ;   3988 extern  __attribute__((__nothrow__)) int vhangup(void) ;
3989 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) revoke)(char const   *__file ) ;   3989 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) revoke)(char const   *__file ) ;
3990 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) profil)(unsigned short *__sample_buffer ,   3990 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) profil)(unsigned short *__sample_buffer ,
3991                                                                                    size_t __size ,   3991                                                                                    size_t __size ,
3992                                                                                    size_t __offset ,   3992                                                                                    size_t __offset ,
3993                                                                                    unsigned int __scale ) ;   3993                                                                                    unsigned int __scale ) ;
3994 extern  __attribute__((__nothrow__)) int acct(char const   *__name ) ;   3994 extern  __attribute__((__nothrow__)) int acct(char const   *__name ) ;
3995 extern  __attribute__((__nothrow__)) char *getusershell(void) ;   3995 extern  __attribute__((__nothrow__)) char *getusershell(void) ;
3996 extern  __attribute__((__nothrow__)) void endusershell(void) ;   3996 extern  __attribute__((__nothrow__)) void endusershell(void) ;
3997 extern  __attribute__((__nothrow__)) void setusershell(void) ;   3997 extern  __attribute__((__nothrow__)) void setusershell(void) ;
3998 extern  __attribute__((__nothrow__)) int daemon(int __nochdir , int __noclose ) ;   3998 extern  __attribute__((__nothrow__)) int daemon(int __nochdir , int __noclose ) ;
3999 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) chroot)(char const   *__path ) ;   3999 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) chroot)(char const   *__path ) ;
4000 extern char *( __attribute__((__nonnull__(1))) getpass)(char const   *__prompt ) ;   4000 extern char *( __attribute__((__nonnull__(1))) getpass)(char const   *__prompt ) ;
4001 extern int fsync(int __fd ) ;   4001 extern int fsync(int __fd ) ;
4002 extern long gethostid(void) ;   4002 extern long gethostid(void) ;
4003 extern  __attribute__((__nothrow__)) void sync(void) ;   4003 extern  __attribute__((__nothrow__)) void sync(void) ;
4004 extern  __attribute__((__nothrow__)) int getpagesize(void)  __attribute__((__const__)) ;   4004 extern  __attribute__((__nothrow__)) int getpagesize(void)  __attribute__((__const__)) ;
4005 extern  __attribute__((__nothrow__)) int getdtablesize(void) ;   4005 extern  __attribute__((__nothrow__)) int getdtablesize(void) ;
4006 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) truncate)(char const   *__file ,   4006 extern  __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1))) truncate)(char const   *__file ,
4007                                                                                      __off64_t __length )  __asm__("truncate64")  ;   4007                                                                                      __off64_t __length )  __asm__("truncate64")  ;
4008 extern  __attribute__((__nothrow__)) int ftruncate(int __fd ,   4008 extern  __attribute__((__nothrow__)) int ftruncate(int __fd ,
4009                                                    __off64_t __length )  __asm__("ftruncate64")  ;   4009                                                    __off64_t __length )  __asm__("ftruncate64")  ;
4010 extern  __attribute__((__nothrow__)) int brk(void *__addr ) ;   4010 extern  __attribute__((__nothrow__)) int brk(void *__addr ) ;
4011 extern  __attribute__((__nothrow__)) void *sbrk(intptr_t __delta ) ;   4011 extern  __attribute__((__nothrow__)) void *sbrk(intptr_t __delta ) ;
4012 extern  __attribute__((__nothrow__)) long syscall(long __sysno  , ...) ;   4012 extern  __attribute__((__nothrow__)) long syscall(long __sysno  , ...) ;
4013 extern int fdatasync(int __fildes ) ;   4013 extern int fdatasync(int __fildes ) ;
4014 struct paperdef PaperTable[49]  =   4014 struct paperdef PaperTable[49]  =
4015   {      {{(char )'d', (char )'e', (char )'f', (char )'a', (char )'u', (char )'l',   4015   {      {{(char )'d', (char )'e', (char )'f', (char )'a', (char )'u', (char )'l',
4016        (char )'t', (char )'\000'}, 8.500, 14.000, 0.607},   4016        (char )'t', (char )'\000'}, 8.500, 14.000, 0.607},
4017         {{(char )'p', (char )'a', (char )'4', (char )'\000'}, 8.264, 11.000, 0.751},   4017         {{(char )'p', (char )'a', (char )'4', (char )'\000'}, 8.264, 11.000, 0.751},
4018         {{(char )'l', (char )'e', (char )'t', (char )'t', (char )'e', (char )'r',   4018         {{(char )'l', (char )'e', (char )'t', (char )'t', (char )'e', (char )'r',
4019        (char )'\000'}, 8.500, 11.000, 0.773},   4019        (char )'\000'}, 8.500, 11.000, 0.773},
4020         {{(char )'l', (char )'e', (char )'g', (char )'a', (char )'l', (char )'\000'},   4020         {{(char )'l', (char )'e', (char )'g', (char )'a', (char )'l', (char )'\000'},
4021       8.500, 14.000, 0.607},   4021       8.500, 14.000, 0.607},
4022         {{(char )'h', (char )'a', (char )'l', (char )'f', (char )'-', (char )'l',   4022         {{(char )'h', (char )'a', (char )'l', (char )'f', (char )'-', (char )'l',
4023        (char )'e', (char )'t', (char )'t', (char )'e', (char )'r', (char )'\000'},   4023        (char )'e', (char )'t', (char )'t', (char )'e', (char )'r', (char )'\000'},
4024       8.500, 5.514, 1.542},   4024       8.500, 5.514, 1.542},
4025         {{(char )'e', (char )'x', (char )'e', (char )'c', (char )'u', (char )'t',   4025         {{(char )'e', (char )'x', (char )'e', (char )'c', (char )'u', (char )'t',
4026        (char )'i', (char )'v', (char )'e', (char )'\000'}, 7.264, 10.528, 0.690},   4026        (char )'i', (char )'v', (char )'e', (char )'\000'}, 7.264, 10.528, 0.690},
4027         {{(char )'t', (char )'a', (char )'b', (char )'l', (char )'o', (char )'i',   4027         {{(char )'t', (char )'a', (char )'b', (char )'l', (char )'o', (char )'i',
4028        (char )'d', (char )'\000'}, 11.000, 17.000, 0.647},   4028        (char )'d', (char )'\000'}, 11.000, 17.000, 0.647},
4029         {{(char )'1', (char )'1', (char )'x', (char )'1', (char )'7', (char )'\000'},   4029         {{(char )'1', (char )'1', (char )'x', (char )'1', (char )'7', (char )'\000'},
4030       11.000, 17.000, 0.647},   4030       11.000, 17.000, 0.647},
4031         {{(char )'l', (char )'e', (char )'d', (char )'g', (char )'e', (char )'r',   4031         {{(char )'l', (char )'e', (char )'d', (char )'g', (char )'e', (char )'r',
4032        (char )'\000'}, 17.000, 11.000, 1.545},   4032        (char )'\000'}, 17.000, 11.000, 1.545},
4033         {{(char )'a', (char )'r', (char )'c', (char )'h', (char )'a', (char )'\000'},   4033         {{(char )'a', (char )'r', (char )'c', (char )'h', (char )'a', (char )'\000'},
4034       9.000, 12.000, 0.750},   4034       9.000, 12.000, 0.750},
4035         {{(char )'a', (char )'r', (char )'c', (char )'h', (char )'b', (char )'\000'},   4035         {{(char )'a', (char )'r', (char )'c', (char )'h', (char )'b', (char )'\000'},
4036       12.000, 18.000, 0.667},   4036       12.000, 18.000, 0.667},
4037         {{(char )'a', (char )'r', (char )'c', (char )'h', (char )'c', (char )'\000'},   4037         {{(char )'a', (char )'r', (char )'c', (char )'h', (char )'c', (char )'\000'},
4038       18.000, 24.000, 0.750},   4038       18.000, 24.000, 0.750},
4039         {{(char )'a', (char )'r', (char )'c', (char )'h', (char )'d', (char )'\000'},   4039         {{(char )'a', (char )'r', (char )'c', (char )'h', (char )'d', (char )'\000'},
4040       24.000, 36.000, 0.667},   4040       24.000, 36.000, 0.667},
4041         {{(char )'a', (char )'r', (char )'c', (char )'h', (char )'e', (char )'\000'},   4041         {{(char )'a', (char )'r', (char )'c', (char )'h', (char )'e', (char )'\000'},
4042       36.000, 48.000, 0.750},   4042       36.000, 48.000, 0.750},
4043         {{(char )'c', (char )'s', (char )'h', (char )'e', (char )'e', (char )'t',   4043         {{(char )'c', (char )'s', (char )'h', (char )'e', (char )'e', (char )'t',
4044        (char )'\000'}, 17.000, 22.000, 0.773},   4044        (char )'\000'}, 17.000, 22.000, 0.773},
4045         {{(char )'d', (char )'s', (char )'h', (char )'e', (char )'e', (char )'t',   4045         {{(char )'d', (char )'s', (char )'h', (char )'e', (char )'e', (char )'t',
4046        (char )'\000'}, 22.000, 34.000, 0.647},   4046        (char )'\000'}, 22.000, 34.000, 0.647},
4047         {{(char )'e', (char )'s', (char )'h', (char )'e', (char )'e', (char )'t',   4047         {{(char )'e', (char )'s', (char )'h', (char )'e', (char )'e', (char )'t',
4048        (char )'\000'}, 34.000, 44.000, 0.773},   4048        (char )'\000'}, 34.000, 44.000, 0.773},
4049         {{(char )'s', (char )'u', (char )'p', (char )'e', (char )'r', (char )'b',   4049         {{(char )'s', (char )'u', (char )'p', (char )'e', (char )'r', (char )'b',
4050        (char )'\000'}, 11.708, 17.042, 0.687},   4050        (char )'\000'}, 11.708, 17.042, 0.687},
4051         {{(char )'c', (char )'o', (char )'m', (char )'m', (char )'e', (char )'r',   4051         {{(char )'c', (char )'o', (char )'m', (char )'m', (char )'e', (char )'r',
4052        (char )'c', (char )'i', (char )'a', (char )'l', (char )'\000'}, 4.139,   4052        (char )'c', (char )'i', (char )'a', (char )'l', (char )'\000'}, 4.139,
4053       9.528, 0.434},   4053       9.528, 0.434},
4054         {{(char )'m', (char )'o', (char )'n', (char )'a', (char )'r', (char )'c',   4054         {{(char )'m', (char )'o', (char )'n', (char )'a', (char )'r', (char )'c',
4055        (char )'h', (char )'\000'}, 3.889, 7.528, 0.517},   4055        (char )'h', (char )'\000'}, 3.889, 7.528, 0.517},
4056         {{(char )'e', (char )'n', (char )'v', (char )'e', (char )'l', (char )'o',   4056         {{(char )'e', (char )'n', (char )'v', (char )'e', (char )'l', (char )'o',
4057        (char )'p', (char )'e', (char )'-', (char )'d', (char )'l', (char )'\000'},   4057        (char )'p', (char )'e', (char )'-', (char )'d', (char )'l', (char )'\000'},
4058       4.333, 8.681, 0.499},   4058       4.333, 8.681, 0.499},
4059         {{(char )'e', (char )'n', (char )'v', (char )'e', (char )'l', (char )'o',   4059         {{(char )'e', (char )'n', (char )'v', (char )'e', (char )'l', (char )'o',
4060        (char )'p', (char )'e', (char )'-', (char )'c', (char )'5', (char )'\000'},   4060        (char )'p', (char )'e', (char )'-', (char )'c', (char )'5', (char )'\000'},
4061       6.389, 9.028, 0.708},   4061       6.389, 9.028, 0.708},
4062         {{(char )'e', (char )'u', (char )'r', (char )'o', (char )'p', (char )'o',   4062         {{(char )'e', (char )'u', (char )'r', (char )'o', (char )'p', (char )'o',
4063        (char )'s', (char )'t', (char )'c', (char )'a', (char )'r', (char )'d',   4063        (char )'s', (char )'t', (char )'c', (char )'a', (char )'r', (char )'d',
4064        (char )'\000'}, 4.139, 5.833, 0.710},   4064        (char )'\000'}, 4.139, 5.833, 0.710},
4065         {{(char )'a', (char )'0', (char )'\000'}, 33.111, 46.806, 0.707},   4065         {{(char )'a', (char )'0', (char )'\000'}, 33.111, 46.806, 0.707},
4066         {{(char )'a', (char )'1', (char )'\000'}, 23.389, 33.111, 0.706},   4066         {{(char )'a', (char )'1', (char )'\000'}, 23.389, 33.111, 0.706},
4067         {{(char )'a', (char )'2', (char )'\000'}, 16.542, 23.389, 0.707},   4067         {{(char )'a', (char )'2', (char )'\000'}, 16.542, 23.389, 0.707},
4068         {{(char )'a', (char )'3', (char )'\000'}, 11.694, 16.542, 0.707},   4068         {{(char )'a', (char )'3', (char )'\000'}, 11.694, 16.542, 0.707},
4069         {{(char )'a', (char )'4', (char )'\000'}, 8.264, 11.694, 0.707},   4069         {{(char )'a', (char )'4', (char )'\000'}, 8.264, 11.694, 0.707},
4070         {{(char )'a', (char )'5', (char )'\000'}, 5.833, 8.264, 0.706},   4070         {{(char )'a', (char )'5', (char )'\000'}, 5.833, 8.264, 0.706},
4071         {{(char )'a', (char )'6', (char )'\000'}, 4.125, 5.833, 0.707},   4071         {{(char )'a', (char )'6', (char )'\000'}, 4.125, 5.833, 0.707},
4072         {{(char )'a', (char )'7', (char )'\000'}, 2.917, 4.125, 0.707},   4072         {{(char )'a', (char )'7', (char )'\000'}, 2.917, 4.125, 0.707},
4073         {{(char )'a', (char )'8', (char )'\000'}, 2.056, 2.917, 0.705},   4073         {{(char )'a', (char )'8', (char )'\000'}, 2.056, 2.917, 0.705},
4074         {{(char )'a', (char )'9', (char )'\000'}, 1.458, 2.056, 0.709},   4074         {{(char )'a', (char )'9', (char )'\000'}, 1.458, 2.056, 0.709},
4075         {{(char )'a', (char )'1', (char )'0', (char )'\000'}, 1.014, 1.458, 0.695},   4075         {{(char )'a', (char )'1', (char )'0', (char )'\000'}, 1.014, 1.458, 0.695},
4076         {{(char )'b', (char )'0', (char )'\000'}, 39.375, 55.667, 0.707},   4076         {{(char )'b', (char )'0', (char )'\000'}, 39.375, 55.667, 0.707},
4077         {{(char )'b', (char )'1', (char )'\000'}, 27.833, 39.375, 0.707},   4077         {{(char )'b', (char )'1', (char )'\000'}, 27.833, 39.375, 0.707},
4078         {{(char )'b', (char )'2', (char )'\000'}, 19.681, 27.833, 0.707},   4078         {{(char )'b', (char )'2', (char )'\000'}, 19.681, 27.833, 0.707},
4079         {{(char )'b', (char )'3', (char )'\000'}, 13.903, 19.681, 0.706},   4079         {{(char )'b', (char )'3', (char )'\000'}, 13.903, 19.681, 0.706},
4080         {{(char )'b', (char )'4', (char )'\000'}, 9.847, 13.903, 0.708},   4080         {{(char )'b', (char )'4', (char )'\000'}, 9.847, 13.903, 0.708},
4081         {{(char )'b', (char )'5', (char )'\000'}, 6.931, 9.847, 0.704},   4081         {{(char )'b', (char )'5', (char )'\000'}, 6.931, 9.847, 0.704},
4082         {{(char )'b', (char )'6', (char )'\000'}, 4.917, 6.931, 0.709},   4082         {{(char )'b', (char )'6', (char )'\000'}, 4.917, 6.931, 0.709},
4083         {{(char )'c', (char )'0', (char )'\000'}, 36.097, 51.069, 0.707},   4083         {{(char )'c', (char )'0', (char )'\000'}, 36.097, 51.069, 0.707},
4084         {{(char )'c', (char )'1', (char )'\000'}, 25.514, 36.097, 0.707},   4084         {{(char )'c', (char )'1', (char )'\000'}, 25.514, 36.097, 0.707},
4085         {{(char )'c', (char )'2', (char )'\000'}, 18.028, 25.514, 0.707},   4085         {{(char )'c', (char )'2', (char )'\000'}, 18.028, 25.514, 0.707},
4086         {{(char )'c', (char )'3', (char )'\000'}, 12.750, 18.028, 0.707},   4086         {{(char )'c', (char )'3', (char )'\000'}, 12.750, 18.028, 0.707},
4087         {{(char )'c', (char )'4', (char )'\000'}, 9.014, 12.750, 0.707},   4087         {{(char )'c', (char )'4', (char )'\000'}, 9.014, 12.750, 0.707},
4088         {{(char )'c', (char )'5', (char )'\000'}, 6.375, 9.014, 0.707},   4088         {{(char )'c', (char )'5', (char )'\000'}, 6.375, 9.014, 0.707},
4089         {{(char )'c', (char )'6', (char )'\000'}, 4.486, 6.375, 0.704},   4089         {{(char )'c', (char )'6', (char )'\000'}, 4.486, 6.375, 0.704},
4090         {{(char )'\000'}, 0.000, 0.000, 1.000}};   4090         {{(char )'\000'}, 0.000, 0.000, 1.000}};
4091 static int outtiled  =    -1;   4091 static int outtiled  =    -1;
4092 static uint32 tilewidth  ;   4092 static uint32 tilewidth  ;
4093 static uint32 tilelength  ;   4093 static uint32 tilelength  ;
4094 static uint16 config  ;   4094 static uint16 config  ;
4095 static uint16 compression  ;   4095 static uint16 compression  ;
4096 static uint16 predictor  ;   4096 static uint16 predictor  ;
4097 static uint16 fillorder  ;   4097 static uint16 fillorder  ;
4098 static uint32 rowsperstrip  ;   4098 static uint32 rowsperstrip  ;
4099 static uint32 g3opts  ;   4099 static uint32 g3opts  ;
4100 static int ignore  =    0;   4100 static int ignore  =    0;
4101 static uint32 defg3opts  =    (uint32 )-1;   4101 static uint32 defg3opts  =    (uint32 )-1;
4102 static int quality  =    75;   4102 static int quality  =    75;
4103 static int jpegcolormode  =    1;   4103 static int jpegcolormode  =    1;
4104 static uint16 defcompression  =    (uint16 )-1;   4104 static uint16 defcompression  =    (uint16 )-1;
4105 static uint16 defpredictor  =    (uint16 )-1;   4105 static uint16 defpredictor  =    (uint16 )-1;
4106 static int pageNum  =    0;   4106 static int pageNum  =    0;
4107 static int little_endian  =    1;   4107 static int little_endian  =    1;
4108 static int readContigStripsIntoBuffer(TIFF *in , uint8 *buf ,   4108 static int readContigStripsIntoBuffer(TIFF *in , uint8 *buf ,
4109                                       uint32 imagelength , uint32 imagewidth ,   4109                                       uint32 imagelength , uint32 imagewidth ,
4110                                       tsample_t spp ) ;   4110                                       tsample_t spp ) ;
4111 static int readSeparateStripsIntoBuffer(TIFF *in , uint8 *obuf , uint32 length ,   4111 static int readSeparateStripsIntoBuffer(TIFF *in , uint8 *obuf , uint32 length ,
4112                                         uint32 width , unsigned short spp ,   4112                                         uint32 width , unsigned short spp ,
4113                                         struct dump_opts *dump ) ;   4113                                         struct dump_opts *dump ) ;
4114 static int readContigTilesIntoBuffer(TIFF *in , uint8 *buf ,   4114 static int readContigTilesIntoBuffer(TIFF *in , uint8 *buf ,
4115                                      uint32 imagelength , uint32 imagewidth ,   4115                                      uint32 imagelength , uint32 imagewidth ,
4116                                      tsample_t spp ) ;   4116                                      tsample_t spp ) ;
4117 static int readSeparateTilesIntoBuffer(TIFF *in , uint8 *buf ,   4117 static int readSeparateTilesIntoBuffer(TIFF *in , uint8 *buf ,
4118                                        uint32 imagelength , uint32 imagewidth ,   4118                                        uint32 imagelength , uint32 imagewidth ,
4119                                        unsigned short spp ) ;   4119                                        unsigned short spp ) ;
4120 static int writeBufferToContigStrips(TIFF *out , uint8 *buf ,   4120 static int writeBufferToContigStrips(TIFF *out , uint8 *buf ,
4121                                      uint32 imagelength , uint32 imagewidth ,   4121                                      uint32 imagelength , uint32 imagewidth ,
4122                                      tsample_t spp ) ;   4122                                      tsample_t spp ) ;
4123 static int writeBufferToContigTiles(TIFF *out , uint8 *buf ,   4123 static int writeBufferToContigTiles(TIFF *out , uint8 *buf ,
4124                                     uint32 imagelength , uint32 imagewidth ,   4124                                     uint32 imagelength , uint32 imagewidth ,
4125                                     tsample_t spp ) ;   4125                                     tsample_t spp ) ;
4126 static int writeBufferToSeparateStrips(TIFF *out , uint8 *buf , uint32 length ,   4126 static int writeBufferToSeparateStrips(TIFF *out , uint8 *buf , uint32 length ,
4127                                        uint32 width , unsigned short spp ,   4127                                        uint32 width , unsigned short spp ,
4128                                        struct dump_opts *dump ) ;   4128                                        struct dump_opts *dump ) ;
4129 static int writeBufferToSeparateTiles(TIFF *out , uint8 *buf ,   4129 static int writeBufferToSeparateTiles(TIFF *out , uint8 *buf ,
4130                                       uint32 imagelength , uint32 imagewidth ,   4130                                       uint32 imagelength , uint32 imagewidth ,
4131                                       tsample_t spp , struct dump_opts *dump ) ;   4131                                       tsample_t spp , struct dump_opts *dump ) ;
4132 static int extractContigSamplesToBuffer(uint8 *out , uint8 *in , uint32 rows ,   4132 static int extractContigSamplesToBuffer(uint8 *out , uint8 *in , uint32 rows ,
4133                                         uint32 cols , int outskew , int inskew ,   4133                                         uint32 cols , int outskew , int inskew ,
4134                                         tsample_t sample , uint16 spp ,   4134                                         tsample_t sample , uint16 spp ,
4135                                         uint16 bps , struct dump_opts *dump ) ;   4135                                         uint16 bps , struct dump_opts *dump ) ;
4136 static void cpStripToTile(uint8 *out , uint8 *in , uint32 rows , uint32 cols ,   4136 static void cpStripToTile(uint8 *out , uint8 *in , uint32 rows , uint32 cols ,
4137                           int outskew , int inskew ) ;   4137                           int outskew , int inskew ) ;
4138 static void cpSeparateBufToContigBuf(uint8 *out , uint8 *in , uint32 rows ,   4138 static void cpSeparateBufToContigBuf(uint8 *out , uint8 *in , uint32 rows ,
4139                                      uint32 cols , int outskew , int inskew ,   4139                                      uint32 cols , int outskew , int inskew ,
4140                                      tsample_t spp , int bytes_per_sample ) ;   4140                                      tsample_t spp , int bytes_per_sample ) ;
4141 static int processCompressOptions(char *opt ) ;   4141 static int processCompressOptions(char *opt ) ;
4142 static void usage(void) ;   4142 static void usage(void) ;
4143 static void initImageData(struct image_data *image ) ;   4143 static void initImageData(struct image_data *image ) ;
4144 static void initCropMasks(struct crop_mask *cps ) ;   4144 static void initCropMasks(struct crop_mask *cps ) ;
4145 static void initPageSetup(struct pagedef *page , struct pageseg *pagelist ,   4145 static void initPageSetup(struct pagedef *page , struct pageseg *pagelist ,
4146                           struct buffinfo *seg_buffs ) ;   4146                           struct buffinfo *seg_buffs ) ;
4147 static void initDumpOptions(struct dump_opts *dump ) ;   4147 static void initDumpOptions(struct dump_opts *dump ) ;
4148 void process_command_opts(int argc , char **argv , char *mp , char *mode ,   4148 void process_command_opts(int argc , char **argv , char *mp , char *mode ,
4149                           uint32 *dirnum , uint16 *defconfig ,   4149                           uint32 *dirnum , uint16 *defconfig ,
4150                           uint16 *deffillorder , uint32 *deftilewidth ,   4150                           uint16 *deffillorder , uint32 *deftilewidth ,
4151                           uint32 *deftilelength , uint32 *defrowsperstrip ,   4151                           uint32 *deftilelength , uint32 *defrowsperstrip ,
4152                           struct crop_mask *crop_data , struct pagedef *page ,   4152                           struct crop_mask *crop_data , struct pagedef *page ,
4153                           struct dump_opts *dump , unsigned int *imagelist ,   4153                           struct dump_opts *dump , unsigned int *imagelist ,
4154                           unsigned int *image_count ) ;   4154                           unsigned int *image_count ) ;
4155 static int update_output_file(TIFF **tiffout , char *mode , int autoindex ,   4155 static int update_output_file(TIFF **tiffout , char *mode , int autoindex ,
4156                               char *outname , unsigned int *page ) ;   4156                               char *outname , unsigned int *page ) ;
4157 static int get_page_geometry(char *name , struct pagedef *page ) ;   4157 static int get_page_geometry(char *name , struct pagedef *page ) ;
4158 static int computeInputPixelOffsets(struct crop_mask *crop ,   4158 static int computeInputPixelOffsets(struct crop_mask *crop ,
4159                                     struct image_data *image ,   4159                                     struct image_data *image ,
4160                                     struct offset *off ) ;   4160                                     struct offset *off ) ;
4161 static int computeOutputPixelOffsets(struct crop_mask *crop ,   4161 static int computeOutputPixelOffsets(struct crop_mask *crop ,
4162                                      struct image_data *image ,   4162                                      struct image_data *image ,
4163                                      struct pagedef *page ,   4163                                      struct pagedef *page ,
4164                                      struct pageseg *sections ,   4164                                      struct pageseg *sections ,
4165                                      struct dump_opts *dump ) ;   4165                                      struct dump_opts *dump ) ;
4166 static int loadImage(TIFF *in , struct image_data *image ,   4166 static int loadImage(TIFF *in , struct image_data *image ,
4167                      struct dump_opts *dump , unsigned char **read_ptr ) ;   4167                      struct dump_opts *dump , unsigned char **read_ptr ) ;
4168 static int correct_orientation(struct image_data *image ,   4168 static int correct_orientation(struct image_data *image ,
4169                                unsigned char **work_buff_ptr ) ;   4169                                unsigned char **work_buff_ptr ) ;
4170 static int getCropOffsets(struct image_data *image , struct crop_mask *crop ,   4170 static int getCropOffsets(struct image_data *image , struct crop_mask *crop ,
4171                           struct dump_opts *dump ) ;   4171                           struct dump_opts *dump ) ;
4172 static int processCropSelections(struct image_data *image ,   4172 static int processCropSelections(struct image_data *image ,
4173                                  struct crop_mask *crop ,   4173                                  struct crop_mask *crop ,
4174                                  unsigned char **read_buff_ptr ,   4174                                  unsigned char **read_buff_ptr ,
4175                                  struct buffinfo *seg_buffs ) ;   4175                                  struct buffinfo *seg_buffs ) ;
4176 static int writeSelections(TIFF *in , TIFF **out , struct crop_mask *crop ,   4176 static int writeSelections(TIFF *in , TIFF **out , struct crop_mask *crop ,
4177                            struct image_data *image , struct dump_opts *dump ,   4177                            struct image_data *image , struct dump_opts *dump ,
4178                            struct buffinfo *seg_buffs , char *mp ,   4178                            struct buffinfo *seg_buffs , char *mp ,
4179                            char *filename , unsigned int *page ,   4179                            char *filename , unsigned int *page ,
4180                            unsigned int total_pages ) ;   4180                            unsigned int total_pages ) ;
4181 static int createImageSection(uint32 sectsize , unsigned char **sect_buff_ptr ) ;   4181 static int createImageSection(uint32 sectsize , unsigned char **sect_buff_ptr ) ;
4182 static int extractImageSection(struct image_data *image ,   4182 static int extractImageSection(struct image_data *image ,
4183                                struct pageseg *section ,   4183                                struct pageseg *section ,
4184                                unsigned char *src_buff ,   4184                                unsigned char *src_buff ,
4185                                unsigned char *sect_buff ) ;   4185                                unsigned char *sect_buff ) ;
4186 static int writeSingleSection(TIFF *in , TIFF *out , struct image_data *image ,   4186 static int writeSingleSection(TIFF *in , TIFF *out , struct image_data *image ,
4187                               struct dump_opts *dump , uint32 width ,   4187                               struct dump_opts *dump , uint32 width ,
4188                               uint32 length , double hres , double vres ,   4188                               uint32 length , double hres , double vres ,
4189                               unsigned char *sect_buff ) ;   4189                               unsigned char *sect_buff ) ;
4190 static int writeImageSections(TIFF *in , TIFF *out , struct image_data *image ,   4190 static int writeImageSections(TIFF *in , TIFF *out , struct image_data *image ,
4191                               struct pagedef *page , struct pageseg *sections ,   4191                               struct pagedef *page , struct pageseg *sections ,
4192                               struct dump_opts *dump , unsigned char *src_buff ,   4192                               struct dump_opts *dump , unsigned char *src_buff ,
4193                               unsigned char **sect_buff_ptr ) ;   4193                               unsigned char **sect_buff_ptr ) ;
4194 static int createCroppedImage(struct image_data *image ,   4194 static int createCroppedImage(struct image_data *image ,
4195                               struct crop_mask *crop ,   4195                               struct crop_mask *crop ,
4196                               unsigned char **read_buff_ptr ,   4196                               unsigned char **read_buff_ptr ,
4197                               unsigned char **crop_buff_ptr ) ;   4197                               unsigned char **crop_buff_ptr ) ;
4198 static int writeCroppedImage(TIFF *in , TIFF *out , struct image_data *image ,   4198 static int writeCroppedImage(TIFF *in , TIFF *out , struct image_data *image ,
4199                              struct dump_opts *dump , uint32 width ,   4199                              struct dump_opts *dump , uint32 width ,
4200                              uint32 length , unsigned char *crop_buff ,   4200                              uint32 length , unsigned char *crop_buff ,
4201                              int pagenum , int total_pages ) ;   4201                              int pagenum , int total_pages ) ;
4202 static int rotateContigSamples8bits(uint16 rotation , uint16 spp , uint16 bps ,   4202 static int rotateContigSamples8bits(uint16 rotation , uint16 spp , uint16 bps ,
4203                                     uint32 width , uint32 length , uint32 col ,   4203                                     uint32 width , uint32 length , uint32 col ,
4204                                     uint8 *src , uint8 *dst ) ;   4204                                     uint8 *src , uint8 *dst ) ;
4205 static int rotateContigSamples16bits(uint16 rotation , uint16 spp , uint16 bps ,   4205 static int rotateContigSamples16bits(uint16 rotation , uint16 spp , uint16 bps ,
4206                                      uint32 width , uint32 length , uint32 col ,   4206                                      uint32 width , uint32 length , uint32 col ,
4207                                      uint8 *src , uint8 *dst ) ;   4207                                      uint8 *src , uint8 *dst ) ;
4208 static int rotateContigSamples24bits(uint16 rotation , uint16 spp , uint16 bps ,   4208 static int rotateContigSamples24bits(uint16 rotation , uint16 spp , uint16 bps ,
4209                                      uint32 width , uint32 length , uint32 col ,   4209                                      uint32 width , uint32 length , uint32 col ,
4210                                      uint8 *src , uint8 *dst ) ;   4210                                      uint8 *src , uint8 *dst ) ;
4211 static int rotateContigSamples32bits(uint16 rotation , uint16 spp , uint16 bps ,   4211 static int rotateContigSamples32bits(uint16 rotation , uint16 spp , uint16 bps ,
4212                                      uint32 width , uint32 length , uint32 col ,   4212                                      uint32 width , uint32 length , uint32 col ,
4213                                      uint8 *src , uint8 *dst ) ;   4213                                      uint8 *src , uint8 *dst ) ;
4214 static int rotateImage(uint16 rotation , struct image_data *image ,   4214 static int rotateImage(uint16 rotation , struct image_data *image ,
4215                        uint32 *img_width , uint32 *img_length ,   4215                        uint32 *img_width , uint32 *img_length ,
4216                        unsigned char **ibuff_ptr ) ;   4216                        unsigned char **ibuff_ptr ) ;
4217 static int mirrorImage(uint16 spp , uint16 bps , uint16 mirror , uint32 width ,   4217 static int mirrorImage(uint16 spp , uint16 bps , uint16 mirror , uint32 width ,
4218                        uint32 length , unsigned char *ibuff ) ;   4218                        uint32 length , unsigned char *ibuff ) ;
4219 static int invertImage(uint16 photometric , uint16 spp , uint16 bps ,   4219 static int invertImage(uint16 photometric , uint16 spp , uint16 bps ,
4220                        uint32 width , uint32 length , unsigned char *work_buff ) ;   4220                        uint32 width , uint32 length , unsigned char *work_buff ) ;
4221 static int reverseSamples8bits(uint16 spp , uint16 bps , uint32 width ,   4221 static int reverseSamples8bits(uint16 spp , uint16 bps , uint32 width ,
4222                                uint8 *ibuff , uint8 *obuff ) ;   4222                                uint8 *ibuff , uint8 *obuff ) ;
4223 static int reverseSamples16bits(uint16 spp , uint16 bps , uint32 width ,   4223 static int reverseSamples16bits(uint16 spp , uint16 bps , uint32 width ,
4224                                 uint8 *ibuff , uint8 *obuff ) ;   4224                                 uint8 *ibuff , uint8 *obuff ) ;
4225 static int reverseSamples24bits(uint16 spp , uint16 bps , uint32 width ,   4225 static int reverseSamples24bits(uint16 spp , uint16 bps , uint32 width ,
4226                                 uint8 *ibuff , uint8 *obuff ) ;   4226                                 uint8 *ibuff , uint8 *obuff ) ;
4227 static int reverseSamples32bits(uint16 spp , uint16 bps , uint32 width ,   4227 static int reverseSamples32bits(uint16 spp , uint16 bps , uint32 width ,
4228                                 uint8 *ibuff , uint8 *obuff ) ;   4228                                 uint8 *ibuff , uint8 *obuff ) ;
4229 static int reverseSamplesBytes(uint16 spp , uint16 bps , uint32 width ,   4229 static int reverseSamplesBytes(uint16 spp , uint16 bps , uint32 width ,
4230                                uint8 *src , uint8 *dst ) ;   4230                                uint8 *src , uint8 *dst ) ;
4231 static int extractSeparateRegion(struct image_data *image ,   4231 static int extractSeparateRegion(struct image_data *image ,
4232                                  struct crop_mask *crop ,   4232                                  struct crop_mask *crop ,
4233                                  unsigned char *read_buff ,   4233                                  unsigned char *read_buff ,
4234                                  unsigned char *crop_buff , int region ) ;   4234                                  unsigned char *crop_buff , int region ) ;
4235 static int extractCompositeRegions(struct image_data *image ,   4235 static int extractCompositeRegions(struct image_data *image ,
4236                                    struct crop_mask *crop ,   4236                                    struct crop_mask *crop ,
4237                                    unsigned char *read_buff ,   4237                                    unsigned char *read_buff ,
4238                                    unsigned char *crop_buff ) ;   4238                                    unsigned char *crop_buff ) ;
4239 static int extractContigSamples8bits(uint8 *in , uint8 *out , uint32 cols ,   4239 static int extractContigSamples8bits(uint8 *in , uint8 *out , uint32 cols ,
4240                                      tsample_t sample , uint16 spp ,   4240                                      tsample_t sample , uint16 spp ,
4241                                      uint16 bps , tsample_t count ,   4241                                      uint16 bps , tsample_t count ,
4242                                      uint32 start , uint32 end ) ;   4242                                      uint32 start , uint32 end ) ;
4243 static int extractContigSamples16bits(uint8 *in , uint8 *out , uint32 cols ,   4243 static int extractContigSamples16bits(uint8 *in , uint8 *out , uint32 cols ,
4244                                       tsample_t sample , uint16 spp ,   4244                                       tsample_t sample , uint16 spp ,
4245                                       uint16 bps , tsample_t count ,   4245                                       uint16 bps , tsample_t count ,
4246                                       uint32 start , uint32 end ) ;   4246                                       uint32 start , uint32 end ) ;
4247 static int extractContigSamples24bits(uint8 *in , uint8 *out , uint32 cols ,   4247 static int extractContigSamples24bits(uint8 *in , uint8 *out , uint32 cols ,
4248                                       tsample_t sample , uint16 spp ,   4248                                       tsample_t sample , uint16 spp ,
4249                                       uint16 bps , tsample_t count ,   4249                                       uint16 bps , tsample_t count ,
4250                                       uint32 start , uint32 end ) ;   4250                                       uint32 start , uint32 end ) ;
4251 static int extractContigSamples32bits(uint8 *in , uint8 *out , uint32 cols ,   4251 static int extractContigSamples32bits(uint8 *in , uint8 *out , uint32 cols ,
4252                                       tsample_t sample , uint16 spp ,   4252                                       tsample_t sample , uint16 spp ,
4253                                       uint16 bps , tsample_t count ,   4253                                       uint16 bps , tsample_t count ,
4254                                       uint32 start , uint32 end ) ;   4254                                       uint32 start , uint32 end ) ;
4255 static int extractContigSamplesBytes(uint8 *in , uint8 *out , uint32 cols ,   4255 static int extractContigSamplesBytes(uint8 *in , uint8 *out , uint32 cols ,
4256                                      tsample_t sample , uint16 spp ,   4256                                      tsample_t sample , uint16 spp ,
4257                                      uint16 bps , tsample_t count ,   4257                                      uint16 bps , tsample_t count ,
4258                                      uint32 start , uint32 end ) ;   4258                                      uint32 start , uint32 end ) ;
4259 static int extractContigSamplesShifted8bits(uint8 *in , uint8 *out ,   4259 static int extractContigSamplesShifted8bits(uint8 *in , uint8 *out ,
4260                                             uint32 cols , tsample_t sample ,   4260                                             uint32 cols , tsample_t sample ,
4261                                             uint16 spp , uint16 bps ,   4261                                             uint16 spp , uint16 bps ,
4262                                             tsample_t count , uint32 start ,   4262                                             tsample_t count , uint32 start ,
4263                                             uint32 end , int shift ) ;   4263                                             uint32 end , int shift ) ;
4264 static int extractContigSamplesShifted16bits(uint8 *in , uint8 *out ,   4264 static int extractContigSamplesShifted16bits(uint8 *in , uint8 *out ,
4265                                              uint32 cols , tsample_t sample ,   4265                                              uint32 cols , tsample_t sample ,
4266                                              uint16 spp , uint16 bps ,   4266                                              uint16 spp , uint16 bps ,
4267                                              tsample_t count , uint32 start ,   4267                                              tsample_t count , uint32 start ,
4268                                              uint32 end , int shift ) ;   4268                                              uint32 end , int shift ) ;
4269 static int extractContigSamplesShifted24bits(uint8 *in , uint8 *out ,   4269 static int extractContigSamplesShifted24bits(uint8 *in , uint8 *out ,
4270                                              uint32 cols , tsample_t sample ,   4270                                              uint32 cols , tsample_t sample ,
4271                                              uint16 spp , uint16 bps ,   4271                                              uint16 spp , uint16 bps ,
4272                                              tsample_t count , uint32 start ,   4272                                              tsample_t count , uint32 start ,
4273                                              uint32 end , int shift ) ;   4273                                              uint32 end , int shift ) ;
4274 static int extractContigSamplesShifted32bits(uint8 *in , uint8 *out ,   4274 static int extractContigSamplesShifted32bits(uint8 *in , uint8 *out ,
4275                                              uint32 cols , tsample_t sample ,   4275                                              uint32 cols , tsample_t sample ,
4276                                              uint16 spp , uint16 bps ,   4276                                              uint16 spp , uint16 bps ,
4277                                              tsample_t count , uint32 start ,   4277                                              tsample_t count , uint32 start ,
4278                                              uint32 end , int shift ) ;   4278                                              uint32 end , int shift ) ;
4279 static int combineSeparateSamples8bits(uint8 **in , uint8 *out , uint32 row ,   4279 static int combineSeparateSamples8bits(uint8 **in , uint8 *out , uint32 row ,
4280                                        uint32 cols , uint16 spp , uint16 bps ,   4280                                        uint32 cols , uint16 spp , uint16 bps ,
4281                                        FILE *dumpfile , int format , int level ) ;   4281                                        FILE *dumpfile , int format , int level ) ;
4282 static int combineSeparateSamples16bits(uint8 **in , uint8 *out , uint32 row ,   4282 static int combineSeparateSamples16bits(uint8 **in , uint8 *out , uint32 row ,
4283                                         uint32 cols , uint16 spp , uint16 bps ,   4283                                         uint32 cols , uint16 spp , uint16 bps ,
4284                                         FILE *dumpfile , int format , int level ) ;   4284                                         FILE *dumpfile , int format , int level ) ;
4285 static int combineSeparateSamples24bits(uint8 **in , uint8 *out , uint32 row ,   4285 static int combineSeparateSamples24bits(uint8 **in , uint8 *out , uint32 row ,
4286                                         uint32 cols , uint16 spp , uint16 bps ,   4286                                         uint32 cols , uint16 spp , uint16 bps ,
4287                                         FILE *dumpfile , int format , int level ) ;   4287                                         FILE *dumpfile , int format , int level ) ;
4288 static int combineSeparateSamples32bits(uint8 **in , uint8 *out , uint32 row ,   4288 static int combineSeparateSamples32bits(uint8 **in , uint8 *out , uint32 row ,
4289                                         uint32 cols , uint16 spp , uint16 bps ,   4289                                         uint32 cols , uint16 spp , uint16 bps ,
4290                                         FILE *dumpfile , int format , int level ) ;   4290                                         FILE *dumpfile , int format , int level ) ;
4291 static int combineSeparateSamplesBytes(unsigned char **srcbuffs ,   4291 static int combineSeparateSamplesBytes(unsigned char **srcbuffs ,
4292                                        unsigned char *out , uint32 row ,   4292                                        unsigned char *out , uint32 row ,
4293                                        uint32 width , unsigned short spp ,   4293                                        uint32 width , unsigned short spp ,
4294                                        uint16 bps , FILE *dumpfile ,   4294                                        uint16 bps , FILE *dumpfile ,
4295                                        int format , int level ) ;   4295                                        int format , int level ) ;
4296 static void dump_info(FILE *dumpfile , int format , char *prefix , char *msg   4296 static void dump_info(FILE *dumpfile , int format , char *prefix , char *msg
4297                       , ...) ;   4297                       , ...) ;
4298 static int dump_data(FILE *dumpfile , int format , char *dump_tag ,   4298 static int dump_data(FILE *dumpfile , int format , char *dump_tag ,
4299                      unsigned char *data , uint32 count ) ;   4299                      unsigned char *data , uint32 count ) ;
4300 static int dump_byte(FILE *dumpfile , int format , char *dump_tag ,   4300 static int dump_byte(FILE *dumpfile , int format , char *dump_tag ,
4301                      unsigned char data ) ;   4301                      unsigned char data ) ;
4302 static int dump_short(FILE *dumpfile , int format , char *dump_tag ,   4302 static int dump_short(FILE *dumpfile , int format , char *dump_tag ,
4303                       uint16 data ) ;   4303                       uint16 data ) ;
4304 static int dump_long(FILE *dumpfile , int format , char *dump_tag , uint32 data ) ;   4304 static int dump_long(FILE *dumpfile , int format , char *dump_tag , uint32 data ) ;
4305 static int dump_wide(FILE *dumpfile , int format , char *dump_tag , uint64 data ) ;   4305 static int dump_wide(FILE *dumpfile , int format , char *dump_tag , uint64 data ) ;
4306 static int dump_buffer(FILE *dumpfile , int format , uint32 rows ,   4306 static int dump_buffer(FILE *dumpfile , int format , uint32 rows ,
4307                        uint32 width , uint32 row , unsigned char *buff ) ;   4307                        uint32 width , uint32 row , unsigned char *buff ) ;
4308 static char tiffcrop_version_id[4]  = {      (char )'2',      (char )'.',      (char )'0',      (char )'\000'};   4308 static char tiffcrop_version_id[4]  = {      (char )'2',      (char )'.',      (char )'0',      (char )'\000'};
4309 static char tiffcrop_rev_date[11]  =   4309 static char tiffcrop_rev_date[11]  =
4310   {      (char )'0',      (char )'1',      (char )'-',      (char )'0',   4310   {      (char )'0',      (char )'1',      (char )'-',      (char )'0',
4311         (char )'6',      (char )'-',      (char )'2',      (char )'0',   4311         (char )'6',      (char )'-',      (char )'2',      (char )'0',
4312         (char )'0',      (char )'9',      (char )'\000'};   4312         (char )'0',      (char )'9',      (char )'\000'};
4313 static char *stuff[127]  =   4313 static char *stuff[127]  =
4314   {      (char *)"usage: tiffcrop [options] source1 ... sourceN  destination",      (char *)"where options are:",      (char *)" -h\t\tPrint this syntax listing",      (char *)" -v\t\tPrint tiffcrop version identifier and last revision date",   4314   {      (char *)"usage: tiffcrop [options] source1 ... sourceN  destination",      (char *)"where options are:",      (char *)" -h\t\tPrint this syntax listing",      (char *)" -v\t\tPrint tiffcrop version identifier and last revision date",
4315         (char *)" ",      (char *)" -a\t\tAppend to output instead of overwriting",      (char *)" -d offset\tSet initial directory offset, counting first image as one, not zero",      (char *)" -p contig\tPack samples contiguously (e.g. RGBRGB...)",   4315         (char *)" ",      (char *)" -a\t\tAppend to output instead of overwriting",      (char *)" -d offset\tSet initial directory offset, counting first image as one, not zero",      (char *)" -p contig\tPack samples contiguously (e.g. RGBRGB...)",
4316         (char *)" -p separate\tStore samples separately (e.g. RRR...GGG...BBB...)",      (char *)" -s\t\tWrite output in strips",      (char *)" -t\t\tWrite output in tiles",      (char *)" -i\t\tIgnore read errors",   4316         (char *)" -p separate\tStore samples separately (e.g. RRR...GGG...BBB...)",      (char *)" -s\t\tWrite output in strips",      (char *)" -t\t\tWrite output in tiles",      (char *)" -i\t\tIgnore read errors",
4317         (char *)" ",      (char *)" -r #\t\tMake each strip have no more than # rows",      (char *)" -w #\t\tSet output tile width (pixels)",      (char *)" -l #\t\tSet output tile length (pixels)",   4317         (char *)" ",      (char *)" -r #\t\tMake each strip have no more than # rows",      (char *)" -w #\t\tSet output tile width (pixels)",      (char *)" -l #\t\tSet output tile length (pixels)",
4318         (char *)" ",      (char *)" -f lsb2msb\tForce lsb-to-msb FillOrder for output",      (char *)" -f msb2lsb\tForce msb-to-lsb FillOrder for output",      (char *)"",   4318         (char *)" ",      (char *)" -f lsb2msb\tForce lsb-to-msb FillOrder for output",      (char *)" -f msb2lsb\tForce msb-to-lsb FillOrder for output",      (char *)"",
4319         (char *)" -c lzw[:opts]\tCompress output with Lempel-Ziv & Welch encoding",      (char *)" -c zip[:opts]\tCompress output with deflate encoding",      (char *)" -c jpeg[:opts]\tcompress output with JPEG encoding",      (char *)" -c packbits\tCompress output with packbits encoding",   4319         (char *)" -c lzw[:opts]\tCompress output with Lempel-Ziv & Welch encoding",      (char *)" -c zip[:opts]\tCompress output with deflate encoding",      (char *)" -c jpeg[:opts]\tcompress output with JPEG encoding",      (char *)" -c packbits\tCompress output with packbits encoding",
4320         (char *)" -c g3[:opts]\tCompress output with CCITT Group 3 encoding",      (char *)" -c g4\t\tCompress output with CCITT Group 4 encoding",      (char *)" -c none\tUse no compression algorithm on output",      (char *)" ",   4320         (char *)" -c g3[:opts]\tCompress output with CCITT Group 3 encoding",      (char *)" -c g4\t\tCompress output with CCITT Group 4 encoding",      (char *)" -c none\tUse no compression algorithm on output",      (char *)" ",
4321         (char *)"Group 3 options:",      (char *)" 1d\t\tUse default CCITT Group 3 1D-encoding",      (char *)" 2d\t\tUse optional CCITT Group 3 2D-encoding",      (char *)" fill\t\tByte-align EOL codes",   4321         (char *)"Group 3 options:",      (char *)" 1d\t\tUse default CCITT Group 3 1D-encoding",      (char *)" 2d\t\tUse optional CCITT Group 3 2D-encoding",      (char *)" fill\t\tByte-align EOL codes",
4322         (char *)"For example, -c g3:2d:fill to get G3-2D-encoded data with byte-aligned EOLs",      (char *)" ",      (char *)"JPEG options:",      (char *)" #\t\tSet compression quality level (0-100, default 75)",   4322         (char *)"For example, -c g3:2d:fill to get G3-2D-encoded data with byte-aligned EOLs",      (char *)" ",      (char *)"JPEG options:",      (char *)" #\t\tSet compression quality level (0-100, default 75)",
4323         (char *)" r\t\tOutput color image as RGB rather than YCbCr",      (char *)"For example, -c jpeg:r:50 to get JPEG-encoded RGB data with 50% comp. quality",      (char *)" ",      (char *)"LZW and deflate options:",   4323         (char *)" r\t\tOutput color image as RGB rather than YCbCr",      (char *)"For example, -c jpeg:r:50 to get JPEG-encoded RGB data with 50% comp. quality",      (char *)" ",      (char *)"LZW and deflate options:",
4324         (char *)" #\t\tSet predictor value",      (char *)"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",      (char *)" ",      (char *)"Page and selection options:",   4324         (char *)" #\t\tSet predictor value",      (char *)"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",      (char *)" ",      (char *)"Page and selection options:",
4325         (char *)" -N odd|even|#,#-#,#|last         sequences and ranges of images within file to process",      (char *)"             The words odd or even may be used to specify all odd or even numbered images.",      (char *)"             The word last may be used in place of a number in the sequence to indicate.",      (char *)"             The final image in the file without knowing how many images there are.",   4325         (char *)" -N odd|even|#,#-#,#|last         sequences and ranges of images within file to process",      (char *)"             The words odd or even may be used to specify all odd or even numbered images.",      (char *)"             The word last may be used in place of a number in the sequence to indicate.",      (char *)"             The final image in the file without knowing how many images there are.",
4326         (char *)"             Numbers are counted from one even though TIFF IFDs are counted from zero.",      (char *)" ",      (char *)" -E t|l|r|b  edge to use as origin for width and length of crop region",      (char *)" -U units    [in, cm, px ] inches, centimeters or pixels",   4326         (char *)"             Numbers are counted from one even though TIFF IFDs are counted from zero.",      (char *)" ",      (char *)" -E t|l|r|b  edge to use as origin for width and length of crop region",      (char *)" -U units    [in, cm, px ] inches, centimeters or pixels",
4327         (char *)" ",      (char *)" -m #,#,#,#  margins from edges for selection: top, left, bottom, right separated by commas",      (char *)" -X #        horizontal dimension of region to extract expressed in current units",      (char *)" -Y #        vertical dimension of region to extract expressed in current units",   4327         (char *)" ",      (char *)" -m #,#,#,#  margins from edges for selection: top, left, bottom, right separated by commas",      (char *)" -X #        horizontal dimension of region to extract expressed in current units",      (char *)" -Y #        vertical dimension of region to extract expressed in current units",
4328         (char *)" -Z #:#,#:#  zones of the image designated as position X of Y,",      (char *)"             eg 1:3 would be first of three equal portions measured from reference edge",      (char *)" -z x1,y1,x2,y2:...:xN,yN,xN+1,yN+1",      (char *)"             regions of the image designated by upper left and lower right coordinates",   4328         (char *)" -Z #:#,#:#  zones of the image designated as position X of Y,",      (char *)"             eg 1:3 would be first of three equal portions measured from reference edge",      (char *)" -z x1,y1,x2,y2:...:xN,yN,xN+1,yN+1",      (char *)"             regions of the image designated by upper left and lower right coordinates",
4329         (char *)"",      (char *)"Export grouping options:",      (char *)" -e c|d|i|m|s    export mode for images and selections from input images.",      (char *)"                 When exporting a composite image from multiple zones or regions",   4329         (char *)"",      (char *)"Export grouping options:",      (char *)" -e c|d|i|m|s    export mode for images and selections from input images.",      (char *)"                 When exporting a composite image from multiple zones or regions",
4330         (char *)"                 (combined and image modes), the selections must have equal sizes",      (char *)"                 for the axis perpendicular to the edge specified with -E.",      (char *)"    c|combined   All images and selections are written to a single file (default).",      (char *)"                 with multiple selections from one image combined into a single image.",   4330         (char *)"                 (combined and image modes), the selections must have equal sizes",      (char *)"                 for the axis perpendicular to the edge specified with -E.",      (char *)"    c|combined   All images and selections are written to a single file (default).",      (char *)"                 with multiple selections from one image combined into a single image.",
4331         (char *)"    d|divided    All images and selections are written to a single file",      (char *)"                 with each selection from one image written to a new image.",      (char *)"    i|image      Each input image is written to a new file (numeric filename sequence)",      (char *)"                 with multiple selections from the image combined into one image.",   4331         (char *)"    d|divided    All images and selections are written to a single file",      (char *)"                 with each selection from one image written to a new image.",      (char *)"    i|image      Each input image is written to a new file (numeric filename sequence)",      (char *)"                 with multiple selections from the image combined into one image.",
4332         (char *)"    m|multiple   Each input image is written to a new file (numeric filename sequence)",      (char *)"                 with each selection from the image written to a new image.",      (char *)"    s|separated  Individual selections from each image are written to separate files.",      (char *)"",   4332         (char *)"    m|multiple   Each input image is written to a new file (numeric filename sequence)",      (char *)"                 with each selection from the image written to a new image.",      (char *)"    s|separated  Individual selections from each image are written to separate files.",      (char *)"",
4333         (char *)"Output options:",      (char *)" -H #        Set horizontal resolution of output images to #",      (char *)" -V #        Set vertical resolution of output images to #",      (char *)" -J #        Set horizontal margin of output page to # expressed in current units",   4333         (char *)"Output options:",      (char *)" -H #        Set horizontal resolution of output images to #",      (char *)" -V #        Set vertical resolution of output images to #",      (char *)" -J #        Set horizontal margin of output page to # expressed in current units",
4334         (char *)" -K #        Set verticalal margin of output page to # expressed in current units",      (char *)" ",      (char *)" -O orient    orientation for output image, portrait, landscape, auto",      (char *)" -P page      page size for output image segments, eg letter, legal, tabloid, etc",   4334         (char *)" -K #        Set verticalal margin of output page to # expressed in current units",      (char *)" ",      (char *)" -O orient    orientation for output image, portrait, landscape, auto",      (char *)" -P page      page size for output image segments, eg letter, legal, tabloid, etc",
4335         (char *)" -S cols:rows Divide the image into equal sized segments using cols across and rows down.",      (char *)" ",      (char *)" -F hor|vert|both",      (char *)"             flip (mirror) image or region horizontally, vertically, or both",   4335         (char *)" -S cols:rows Divide the image into equal sized segments using cols across and rows down.",      (char *)" ",      (char *)" -F hor|vert|both",      (char *)"             flip (mirror) image or region horizontally, vertically, or both",
4336         (char *)" -R #        [90,180,or 270] degrees clockwise rotation of image or extracted region",      (char *)" -I [black|white|data|both]",      (char *)"             invert color space, eg dark to light for bilevel and grayscale images",      (char *)"             If argument is white or black, set the PHOTOMETRIC_INTERPRETATION ",   4336         (char *)" -R #        [90,180,or 270] degrees clockwise rotation of image or extracted region",      (char *)" -I [black|white|data|both]",      (char *)"             invert color space, eg dark to light for bilevel and grayscale images",      (char *)"             If argument is white or black, set the PHOTOMETRIC_INTERPRETATION ",
4337         (char *)"             tag to MinIsBlack or MinIsWhite without altering the image data",      (char *)"             If the argument is data or both, the image data are modified:",      (char *)"             both inverts the data and the PHOTOMETRIC_INTERPRETATION tag,",      (char *)"             data inverts the data but not the PHOTOMETRIC_INTERPRETATION tag",   4337         (char *)"             tag to MinIsBlack or MinIsWhite without altering the image data",      (char *)"             If the argument is data or both, the image data are modified:",      (char *)"             both inverts the data and the PHOTOMETRIC_INTERPRETATION tag,",      (char *)"             data inverts the data but not the PHOTOMETRIC_INTERPRETATION tag",
4338         (char *)" ",      (char *)"-D opt1:value1,opt2:value2,opt3:value3:opt4:value4",      (char *)"             Debug/dump program progress and/or data to non-TIFF files.",      (char *)"             Options include the following and must be joined as a comma",   4338         (char *)" ",      (char *)"-D opt1:value1,opt2:value2,opt3:value3:opt4:value4",      (char *)"             Debug/dump program progress and/or data to non-TIFF files.",      (char *)"             Options include the following and must be joined as a comma",
4339         (char *)"             separate list. The use of this option is generally limited to",      (char *)"             program debugging and development of future options.",      (char *)" ",      (char *)"   debug:N   Display limited program progress indicators where larger N",   4339         (char *)"             separate list. The use of this option is generally limited to",      (char *)"             program debugging and development of future options.",      (char *)" ",      (char *)"   debug:N   Display limited program progress indicators where larger N",
4340         (char *)"             increase the level of detail. The program must be compiled with",      (char *)"             -DDEBUG -DDEBUG2 to enable full debug reporting",      (char *)"",      (char *)"   format:txt|raw  Format any logged data as ASCII text or raw binary ",   4340         (char *)"             increase the level of detail. The program must be compiled with",      (char *)"             -DDEBUG -DDEBUG2 to enable full debug reporting",      (char *)"",      (char *)"   format:txt|raw  Format any logged data as ASCII text or raw binary ",
4341         (char *)"             values. ASCII text dumps include strings of ones and zeroes",      (char *)"             representing the binary values in the image data plus identifying headers.",      (char *)" ",      (char *)"   level:N   Specify the level of detail presented in the dump files.",   4341         (char *)"             values. ASCII text dumps include strings of ones and zeroes",      (char *)"             representing the binary values in the image data plus identifying headers.",      (char *)" ",      (char *)"   level:N   Specify the level of detail presented in the dump files.",
4342         (char *)"             This can vary from dumps of the entire input or output image data to dumps",      (char *)"             of data processed by specific functions. Current range of levels is 1 to 3.",      (char *)" ",      (char *)"   input:full-path-to-directory/input-dumpname",   4342         (char *)"             This can vary from dumps of the entire input or output image data to dumps",      (char *)"             of data processed by specific functions. Current range of levels is 1 to 3.",      (char *)" ",      (char *)"   input:full-path-to-directory/input-dumpname",
4343         (char *)" ",      (char *)"   output:full-path-to-directory/output-dumpnaem",      (char *)" ",      (char *)"             When dump files are being written, each image will be written to a separate",   4343         (char *)" ",      (char *)"   output:full-path-to-directory/output-dumpnaem",      (char *)" ",      (char *)"             When dump files are being written, each image will be written to a separate",
4344         (char *)"             file with the name built by adding a numeric sequence value to the dumpname",      (char *)"             and an extension of .txt for ASCII dumps or .bin for binary dumps.",      (char *)" ",      (char *)"             The four debug/dump options are independent, though it makes little sense to",   4344         (char *)"             file with the name built by adding a numeric sequence value to the dumpname",      (char *)"             and an extension of .txt for ASCII dumps or .bin for binary dumps.",      (char *)" ",      (char *)"             The four debug/dump options are independent, though it makes little sense to",
4345         (char *)"             specify a dump file without specifying a detail level.",      (char *)" ",      (char *)((void *)0)};   4345         (char *)"             specify a dump file without specifying a detail level.",      (char *)" ",      (char *)((void *)0)};
4346 static int readContigTilesIntoBuffer(TIFF *in ,   4346 static int readContigTilesIntoBuffer(TIFF *in ,
4347                                      uint8 *buf , uint32 imagelength ,   4347                                      uint8 *buf , uint32 imagelength ,
4348                                      uint32 imagewidth , tsample_t spp )   4348                                      uint32 imagewidth , tsample_t spp )
4349 {   4349 {
4350   int status ;   4350   int status ;
4351   tdata_t tilebuf ;   4351   tdata_t tilebuf ;
4352   tmsize_t tmp ;   4352   tmsize_t tmp ;
4353   void *tmp___0 ;   4353   void *tmp___0 ;
4354   uint32 imagew ;   4354   uint32 imagew ;
4355   tmsize_t tmp___1 ;   4355   tmsize_t tmp___1 ;
4356   uint32 tilew ;   4356   uint32 tilew ;
4357   tmsize_t tmp___2 ;   4357   tmsize_t tmp___2 ;
4358   int iskew ;   4358   int iskew ;
4359   uint8 *bufp ;   4359   uint8 *bufp ;
4360   uint32 tw ;   4360   uint32 tw ;
4361   uint32 tl ;   4361   uint32 tl ;
4362   uint32 row ;   4362   uint32 row ;
4363   uint32 nrow ;   4363   uint32 nrow ;
4364   uint32 tmp___3 ;   4364   uint32 tmp___3 ;
4365   uint32 colb ;   4365   uint32 colb ;
4366   uint32 col ;   4366   uint32 col ;
4367   char const   *tmp___4 ;   4367   char const   *tmp___4 ;
4368   tmsize_t tmp___5 ;   4368   tmsize_t tmp___5 ;
4369   uint32 width ;   4369   uint32 width ;
4370   uint32 oskew ;   4370   uint32 oskew ;
4371     4371  
4372   {   4372   {
4373   status = 1;   4373   status = 1;
4374   tmp = TIFFTileSize(in);   4374   tmp = TIFFTileSize(in);
4375   tmp___0 = _TIFFmalloc(tmp);   4375   tmp___0 = _TIFFmalloc(tmp);
4376   tilebuf = tmp___0;   4376   tilebuf = tmp___0;
4377   tmp___1 = TIFFScanlineSize(in);   4377   tmp___1 = TIFFScanlineSize(in);
4378   imagew = (uint32 )tmp___1;   4378   imagew = (uint32 )tmp___1;
4379   tmp___2 = TIFFTileRowSize(in);   4379   tmp___2 = TIFFTileRowSize(in);
4380   tilew = (uint32 )tmp___2;   4380   tilew = (uint32 )tmp___2;
4381   iskew = (int )(imagew - tilew);   4381   iskew = (int )(imagew - tilew);
4382   bufp = buf;   4382   bufp = buf;
4383   if ((unsigned int )tilebuf == (unsigned int )((tdata_t )0)) {   4383   if ((unsigned int )tilebuf == (unsigned int )((tdata_t )0)) {
4384     return (0);   4384     return (0);
4385   } else {   4385   } else {
4386     4386  
4387   }   4387   }
4388   TIFFGetField(in, (uint32 )322, & tw);   4388   TIFFGetField(in, (uint32 )322, & tw);
4389   TIFFGetField(in, (uint32 )323, & tl);   4389   TIFFGetField(in, (uint32 )323, & tl);
4390   row = (uint32 )0;   4390   row = (uint32 )0;
4391   while (row < imagelength) {   4391   while (row < imagelength) {
4392     if (row + tl > imagelength) {   4392     if (row + tl > imagelength) {
4393       tmp___3 = imagelength - row;   4393       tmp___3 = imagelength - row;
4394     } else {   4394     } else {
4395       tmp___3 = tl;   4395       tmp___3 = tl;
4396     }   4396     }
4397     nrow = tmp___3;   4397     nrow = tmp___3;
4398     colb = (uint32 )0;   4398     colb = (uint32 )0;
4399     col = (uint32 )0;   4399     col = (uint32 )0;
4400     while (col < imagewidth) {   4400     while (col < imagewidth) {
4401       tmp___5 = TIFFReadTile(in, tilebuf, col, row, (uint32 )0, (uint16 )0);   4401       tmp___5 = TIFFReadTile(in, tilebuf, col, row, (uint32 )0, (uint16 )0);
4402       if (tmp___5 < 0L) {   4402       if (tmp___5 < 0L) {
4403         if (! ignore) {   4403         if (! ignore) {
4404           tmp___4 = TIFFFileName(in);   4404           tmp___4 = TIFFFileName(in);
4405           TIFFError(tmp___4, "Error, can\'t read tile at %lu %lu",   4405           TIFFError(tmp___4, "Error, can\'t read tile at %lu %lu",
4406                     (unsigned long )col, (unsigned long )row);   4406                     (unsigned long )col, (unsigned long )row);
4407           status = 0;   4407           status = 0;
4408           goto done;   4408           goto done;
4409         } else {   4409         } else {
4410     4410  
4411         }   4411         }
4412       } else {   4412       } else {
4413     4413  
4414       }   4414       }
4415       if (colb + tilew > imagew) {   4415       if (colb + tilew > imagew) {
4416         width = imagew - colb;   4416         width = imagew - colb;
4417         oskew = tilew - width;   4417         oskew = tilew - width;
4418         cpStripToTile(bufp + colb, (uint8 *)tilebuf, nrow, width,   4418         cpStripToTile(bufp + colb, (uint8 *)tilebuf, nrow, width,
4419                       (int )(oskew + (uint32 )iskew), (int )oskew);   4419                       (int )(oskew + (uint32 )iskew), (int )oskew);
4420       } else {   4420       } else {
4421         cpStripToTile(bufp + colb, (uint8 *)tilebuf, nrow, tilew, iskew, 0);   4421         cpStripToTile(bufp + colb, (uint8 *)tilebuf, nrow, tilew, iskew, 0);
4422       }   4422       }
4423       colb += tilew;   4423       colb += tilew;
4424       col += tw;   4424       col += tw;
4425     }   4425     }
4426     bufp += imagew * nrow;   4426     bufp += imagew * nrow;
4427     row += tl;   4427     row += tl;
4428   }   4428   }
4429   done:   4429   done:
4430   _TIFFfree(tilebuf);   4430   _TIFFfree(tilebuf);
4431   return (status);   4431   return (status);
4432 }   4432 }
4433 }   4433 }
4434 static int readSeparateTilesIntoBuffer(TIFF *in , uint8 *buf ,   4434 static int readSeparateTilesIntoBuffer(TIFF *in , uint8 *buf ,
4435                                        uint32 imagelength , uint32 imagewidth ,   4435                                        uint32 imagelength , uint32 imagewidth ,
4436                                        unsigned short spp )   4436                                        unsigned short spp )
4437 {   4437 {
4438   int status ;   4438   int status ;
4439   uint32 imagew ;   4439   uint32 imagew ;
4440   tmsize_t tmp ;   4440   tmsize_t tmp ;
4441   uint32 tilew ;   4441   uint32 tilew ;
4442   tmsize_t tmp___0 ;   4442   tmsize_t tmp___0 ;
4443   int iskew ;   4443   int iskew ;
4444   tdata_t tilebuf ;   4444   tdata_t tilebuf ;
4445   tmsize_t tmp___1 ;   4445   tmsize_t tmp___1 ;
4446   void *tmp___2 ;   4446   void *tmp___2 ;
4447   uint8 *bufp ;   4447   uint8 *bufp ;
4448   uint32 tw ;   4448   uint32 tw ;
4449   uint32 tl ;   4449   uint32 tl ;
4450   uint32 row ;   4450   uint32 row ;
4451   uint16 bps ;   4451   uint16 bps ;
4452   uint16 bytes_per_sample ;   4452   uint16 bytes_per_sample ;
4453   uint32 nrow ;   4453   uint32 nrow ;
4454   uint32 tmp___3 ;   4454   uint32 tmp___3 ;
4455   uint32 colb ;   4455   uint32 colb ;
4456   uint32 col ;   4456   uint32 col ;
4457   tsample_t s ;   4457   tsample_t s ;
4458   char const   *tmp___4 ;   4458   char const   *tmp___4 ;
4459   tmsize_t tmp___5 ;   4459   tmsize_t tmp___5 ;
4460   uint32 width ;   4460   uint32 width ;
4461   int oskew ;   4461   int oskew ;
4462     4462  
4463   {   4463   {
4464   status = 1;   4464   status = 1;
4465   tmp = TIFFRasterScanlineSize(in);   4465   tmp = TIFFRasterScanlineSize(in);
4466   imagew = (uint32 )tmp;   4466   imagew = (uint32 )tmp;
4467   tmp___0 = TIFFTileRowSize(in);   4467   tmp___0 = TIFFTileRowSize(in);
4468   tilew = (uint32 )tmp___0;   4468   tilew = (uint32 )tmp___0;
4469   iskew = (int )(imagew - tilew * (uint32 )spp);   4469   iskew = (int )(imagew - tilew * (uint32 )spp);
4470   tmp___1 = TIFFTileSize(in);   4470   tmp___1 = TIFFTileSize(in);
4471   tmp___2 = _TIFFmalloc(tmp___1);   4471   tmp___2 = _TIFFmalloc(tmp___1);
4472   tilebuf = tmp___2;   4472   tilebuf = tmp___2;
4473   bufp = buf;   4473   bufp = buf;
4474   if ((unsigned int )tilebuf == (unsigned int )((tdata_t )0)) {   4474   if ((unsigned int )tilebuf == (unsigned int )((tdata_t )0)) {
4475     return (0);   4475     return (0);
4476   } else {   4476   } else {
4477     4477  
4478   }   4478   }
4479   TIFFGetField(in, (uint32 )322, & tw);   4479   TIFFGetField(in, (uint32 )322, & tw);
4480   TIFFGetField(in, (uint32 )323, & tl);   4480   TIFFGetField(in, (uint32 )323, & tl);
4481   TIFFGetField(in, (uint32 )258, & bps);   4481   TIFFGetField(in, (uint32 )258, & bps);
4482   if ((int )bps % 8 == 0) {   4482   if ((int )bps % 8 == 0) {
4483     4483  
4484   } else {   4484   } else {
4485     __assert_fail("bps % 8 == 0", "tiffcrop.c", 800U,   4485     __assert_fail("bps % 8 == 0", "tiffcrop.c", 800U,
4486                   "readSeparateTilesIntoBuffer");   4486                   "readSeparateTilesIntoBuffer");
4487   }   4487   }
4488   bytes_per_sample = (uint16 )((int )bps / 8);   4488   bytes_per_sample = (uint16 )((int )bps / 8);
4489   row = (uint32 )0;   4489   row = (uint32 )0;
4490   while (row < imagelength) {   4490   while (row < imagelength) {
4491     if (row + tl > imagelength) {   4491     if (row + tl > imagelength) {
4492       tmp___3 = imagelength - row;   4492       tmp___3 = imagelength - row;
4493     } else {   4493     } else {
4494       tmp___3 = tl;   4494       tmp___3 = tl;
4495     }   4495     }
4496     nrow = tmp___3;   4496     nrow = tmp___3;
4497     colb = (uint32 )0;   4497     colb = (uint32 )0;
4498     col = (uint32 )0;   4498     col = (uint32 )0;
4499     while (col < imagewidth) {   4499     while (col < imagewidth) {
4500       s = (tsample_t )0;   4500       s = (tsample_t )0;
4501       while ((int )s < (int )spp) {   4501       while ((int )s < (int )spp) {
4502         tmp___5 = TIFFReadTile(in, tilebuf, col, row, (uint32 )0, s);   4502         tmp___5 = TIFFReadTile(in, tilebuf, col, row, (uint32 )0, s);
4503         if (tmp___5 < 0L) {   4503         if (tmp___5 < 0L) {
4504           if (! ignore) {   4504           if (! ignore) {
4505             tmp___4 = TIFFFileName(in);   4505             tmp___4 = TIFFFileName(in);
4506             TIFFError(tmp___4, "Error, can\'t read tile at %lu %lu, sample %lu",   4506             TIFFError(tmp___4, "Error, can\'t read tile at %lu %lu, sample %lu",
4507                       (unsigned long )col, (unsigned long )row,   4507                       (unsigned long )col, (unsigned long )row,
4508                       (unsigned long )s);   4508                       (unsigned long )s);
4509             status = 0;   4509             status = 0;
4510             goto done;   4510             goto done;
4511           } else {   4511           } else {
4512     4512  
4513           }   4513           }
4514         } else {   4514         } else {
4515     4515  
4516         }   4516         }
4517         if (colb + tilew * (uint32 )spp > imagew) {   4517         if (colb + tilew * (uint32 )spp > imagew) {
4518           width = imagew - colb;   4518           width = imagew - colb;
4519           oskew = (int )(tilew * (uint32 )spp - width);   4519           oskew = (int )(tilew * (uint32 )spp - width);
4520           cpSeparateBufToContigBuf((bufp + colb) + (int )s * (int )bytes_per_sample,   4520           cpSeparateBufToContigBuf((bufp + colb) + (int )s * (int )bytes_per_sample,
4521                                    (uint8 *)tilebuf, nrow,   4521                                    (uint8 *)tilebuf, nrow,
4522                                    width / (uint32 )((int )spp * (int )bytes_per_sample),   4522                                    width / (uint32 )((int )spp * (int )bytes_per_sample),
4523                                    oskew + iskew, oskew / (int )spp, spp,   4523                                    oskew + iskew, oskew / (int )spp, spp,
4524                                    (int )bytes_per_sample);   4524                                    (int )bytes_per_sample);
4525         } else {   4525         } else {
4526           cpSeparateBufToContigBuf((bufp + colb) + (int )s * (int )bytes_per_sample,   4526           cpSeparateBufToContigBuf((bufp + colb) + (int )s * (int )bytes_per_sample,
4527                                    (uint8 *)tilebuf, nrow, tw, iskew, 0, spp,   4527                                    (uint8 *)tilebuf, nrow, tw, iskew, 0, spp,
4528                                    (int )bytes_per_sample);   4528                                    (int )bytes_per_sample);
4529         }   4529         }
4530         s = (tsample_t )((int )s + 1);   4530         s = (tsample_t )((int )s + 1);
4531       }   4531       }
4532       colb += tilew * (uint32 )spp;   4532       colb += tilew * (uint32 )spp;
4533       col += tw;   4533       col += tw;
4534     }   4534     }
4535     bufp += imagew * nrow;   4535     bufp += imagew * nrow;
4536     row += tl;   4536     row += tl;
4537   }   4537   }
4538   done:   4538   done:
4539   _TIFFfree(tilebuf);   4539   _TIFFfree(tilebuf);
4540   return (status);   4540   return (status);
4541 }   4541 }
4542 }   4542 }
4543 static int writeBufferToContigStrips(TIFF *out , uint8 *buf ,   4543 static int writeBufferToContigStrips(TIFF *out , uint8 *buf ,
4544                                      uint32 imagelength , uint32 imagewidth ,   4544                                      uint32 imagelength , uint32 imagewidth ,
4545                                      tsample_t spp )   4545                                      tsample_t spp )
4546 {   4546 {
4547   uint32 row ;   4547   uint32 row ;
4548   uint32 rowsperstrip___0 ;   4548   uint32 rowsperstrip___0 ;
4549   tstrip_t strip ;   4549   tstrip_t strip ;
4550   uint32 nrows ;   4550   uint32 nrows ;
4551   uint32 tmp ;   4551   uint32 tmp ;
4552   tsize_t stripsize ;   4552   tsize_t stripsize ;
4553   tmsize_t tmp___0 ;   4553   tmsize_t tmp___0 ;
4554   char const   *tmp___1 ;   4554   char const   *tmp___1 ;
4555   tstrip_t tmp___2 ;   4555   tstrip_t tmp___2 ;
4556   tmsize_t tmp___3 ;   4556   tmsize_t tmp___3 ;
4557     4557  
4558   {   4558   {
4559   strip = (tstrip_t )0;   4559   strip = (tstrip_t )0;
4560   TIFFGetFieldDefaulted(out, (uint32 )278, & rowsperstrip___0);   4560   TIFFGetFieldDefaulted(out, (uint32 )278, & rowsperstrip___0);
4561   row = (uint32 )0;   4561   row = (uint32 )0;
4562   while (row < imagelength) {   4562   while (row < imagelength) {
4563     if (row + rowsperstrip___0 > imagelength) {   4563     if (row + rowsperstrip___0 > imagelength) {
4564       tmp = imagelength - row;   4564       tmp = imagelength - row;
4565     } else {   4565     } else {
4566       tmp = rowsperstrip___0;   4566       tmp = rowsperstrip___0;
4567     }   4567     }
4568     nrows = tmp;   4568     nrows = tmp;
4569     tmp___0 = TIFFVStripSize(out, nrows);   4569     tmp___0 = TIFFVStripSize(out, nrows);
4570     stripsize = tmp___0;   4570     stripsize = tmp___0;
4571     tmp___2 = strip;   4571     tmp___2 = strip;
4572     strip ++;   4572     strip ++;
4573     tmp___3 = TIFFWriteEncodedStrip(out, tmp___2, (void *)buf, stripsize);   4573     tmp___3 = TIFFWriteEncodedStrip(out, tmp___2, (void *)buf, stripsize);
4574     if (tmp___3 < 0L) {   4574     if (tmp___3 < 0L) {
4575       tmp___1 = TIFFFileName(out);   4575       tmp___1 = TIFFFileName(out);
4576       TIFFError(tmp___1, "Error, can\'t write strip %u", strip - 1U);   4576       TIFFError(tmp___1, "Error, can\'t write strip %u", strip - 1U);
4577       return (0);   4577       return (0);
4578     } else {   4578     } else {
4579     4579  
4580     }   4580     }
4581     buf += stripsize;   4581     buf += stripsize;
4582     row += rowsperstrip___0;   4582     row += rowsperstrip___0;
4583   }   4583   }
4584   return (1);   4584   return (1);
4585 }   4585 }
4586 }   4586 }
4587 static int writeBufferToSeparateStrips(TIFF *out , uint8 *buf , uint32 length ,   4587 static int writeBufferToSeparateStrips(TIFF *out , uint8 *buf , uint32 length ,
4588                                        uint32 width , unsigned short spp ,   4588                                        uint32 width , unsigned short spp ,
4589                                        struct dump_opts *dump )   4589                                        struct dump_opts *dump )
4590 {   4590 {
4591   uint8 *src ;   4591   uint8 *src ;
4592   uint16 bps ;   4592   uint16 bps ;
4593   uint32 row ;   4593   uint32 row ;
4594   uint32 nrows ;   4594   uint32 nrows ;
4595   uint32 rowsize ;   4595   uint32 rowsize ;
4596   uint32 rowsperstrip___0 ;   4596   uint32 rowsperstrip___0 ;
4597   uint32 bytes_per_sample ;   4597   uint32 bytes_per_sample ;
4598   tsample_t s ;   4598   tsample_t s ;
4599   tstrip_t strip ;   4599   tstrip_t strip ;
4600   tsize_t stripsize ;   4600   tsize_t stripsize ;
4601   tmsize_t tmp ;   4601   tmsize_t tmp ;
4602   tsize_t rowstripsize ;   4602   tsize_t rowstripsize ;
4603   tsize_t scanlinesize ;   4603   tsize_t scanlinesize ;
4604   tmsize_t tmp___0 ;   4604   tmsize_t tmp___0 ;
4605   tsize_t total_bytes ;   4605   tsize_t total_bytes ;
4606   tdata_t obuf ;   4606   tdata_t obuf ;
4607   int tmp___1 ;   4607   int tmp___1 ;
4608   char const   *tmp___2 ;   4608   char const   *tmp___2 ;
4609   tstrip_t tmp___3 ;   4609   tstrip_t tmp___3 ;
4610   tmsize_t tmp___4 ;   4610   tmsize_t tmp___4 ;
4611     4611  
4612   {   4612   {
4613   strip = (tstrip_t )0;   4613   strip = (tstrip_t )0;
4614   tmp = TIFFStripSize(out);   4614   tmp = TIFFStripSize(out);
4615   stripsize = tmp;   4615   stripsize = tmp;
4616   tmp___0 = TIFFScanlineSize(out);   4616   tmp___0 = TIFFScanlineSize(out);
4617   scanlinesize = tmp___0;   4617   scanlinesize = tmp___0;
4618   total_bytes = (tsize_t )0;   4618   total_bytes = (tsize_t )0;
4619   TIFFGetFieldDefaulted(out, (uint32 )278, & rowsperstrip___0);   4619   TIFFGetFieldDefaulted(out, (uint32 )278, & rowsperstrip___0);
4620   TIFFGetField(out, (uint32 )258, & bps);   4620   TIFFGetField(out, (uint32 )258, & bps);
4621   bytes_per_sample = (uint32 )(((int )bps + 7) / 8);   4621   bytes_per_sample = (uint32 )(((int )bps + 7) / 8);
4622   rowsize = ((uint32 )((int )bps * (int )spp) * width + 7U) / 8U;   4622   rowsize = ((uint32 )((int )bps * (int )spp) * width + 7U) / 8U;
4623   rowstripsize = (tsize_t )((rowsperstrip___0 * bytes_per_sample) * (width + 1U));   4623   rowstripsize = (tsize_t )((rowsperstrip___0 * bytes_per_sample) * (width + 1U));
4624   obuf = _TIFFmalloc(rowstripsize);   4624   obuf = _TIFFmalloc(rowstripsize);
4625   if ((unsigned int )obuf == (unsigned int )((void *)0)) {   4625   if ((unsigned int )obuf == (unsigned int )((void *)0)) {
4626     return (0);   4626     return (0);
4627   } else {   4627   } else {
4628     4628  
4629   }   4629   }
4630   s = (tsample_t )0;   4630   s = (tsample_t )0;
4631   while ((int )s < (int )spp) {   4631   while ((int )s < (int )spp) {
4632     row = (uint32 )0;   4632     row = (uint32 )0;
4633     while (row < length) {   4633     while (row < length) {
4634       if (row + rowsperstrip___0 > length) {   4634       if (row + rowsperstrip___0 > length) {
4635         nrows = length - row;   4635         nrows = length - row;
4636       } else {   4636       } else {
4637         nrows = rowsperstrip___0;   4637         nrows = rowsperstrip___0;
4638       }   4638       }
4639       stripsize = TIFFVStripSize(out, nrows);   4639       stripsize = TIFFVStripSize(out, nrows);
4640       src = buf + row * rowsize;   4640       src = buf + row * rowsize;
4641       total_bytes += stripsize;   4641       total_bytes += stripsize;
4642       memset(obuf, '\000', (size_t )rowstripsize);   4642       memset(obuf, '\000', (size_t )rowstripsize);
4643       tmp___1 = extractContigSamplesToBuffer((uint8 *)obuf, src, nrows, width,   4643       tmp___1 = extractContigSamplesToBuffer((uint8 *)obuf, src, nrows, width,
4644                                              0, 0, s, spp, bps, dump);   4644                                              0, 0, s, spp, bps, dump);
4645       if (tmp___1) {   4645       if (tmp___1) {
4646         _TIFFfree(obuf);   4646         _TIFFfree(obuf);
4647         return (0);   4647         return (0);
4648       } else {   4648       } else {
4649     4649  
4650       }   4650       }
4651       if ((unsigned int )dump->outfile != (unsigned int )((void *)0)) {   4651       if ((unsigned int )dump->outfile != (unsigned int )((void *)0)) {
4652         if (dump->level == 1) {   4652         if (dump->level == 1) {
4653           dump_info(dump->outfile, dump->format, (char *)"",   4653           dump_info(dump->outfile, dump->format, (char *)"",
4654                     (char *)"Sample %2d, Strip: %2d, bytes: %4d, Row %4d, bytes: %4d, Input offset: %6d",   4654                     (char *)"Sample %2d, Strip: %2d, bytes: %4d, Row %4d, bytes: %4d, Input offset: %6d",
4655                     (int )s + 1, strip + 1U, stripsize, row + 1U, scanlinesize,   4655                     (int )s + 1, strip + 1U, stripsize, row + 1U, scanlinesize,
4656                     src - buf);   4656                     src - buf);
4657           dump_buffer(dump->outfile, dump->format, nrows, (uint32 )scanlinesize,   4657           dump_buffer(dump->outfile, dump->format, nrows, (uint32 )scanlinesize,
4658                       row, (unsigned char *)obuf);   4658                       row, (unsigned char *)obuf);
4659         } else {   4659         } else {
4660     4660  
4661         }   4661         }
4662       } else {   4662       } else {
4663     4663  
4664       }   4664       }
4665       tmp___3 = strip;   4665       tmp___3 = strip;
4666       strip ++;   4666       strip ++;
4667       tmp___4 = TIFFWriteEncodedStrip(out, tmp___3, obuf, stripsize);   4667       tmp___4 = TIFFWriteEncodedStrip(out, tmp___3, obuf, stripsize);
4668       if (tmp___4 < 0L) {   4668       if (tmp___4 < 0L) {
4669         tmp___2 = TIFFFileName(out);   4669         tmp___2 = TIFFFileName(out);
4670         TIFFError(tmp___2, "Error, can\'t write strip %u", strip - 1U);   4670         TIFFError(tmp___2, "Error, can\'t write strip %u", strip - 1U);
4671         _TIFFfree(obuf);   4671         _TIFFfree(obuf);
4672         return (0);   4672         return (0);
4673       } else {   4673       } else {
4674     4674  
4675       }   4675       }
4676       row += rowsperstrip___0;   4676       row += rowsperstrip___0;
4677     }   4677     }
4678     s = (tsample_t )((int )s + 1);   4678     s = (tsample_t )((int )s + 1);
4679   }   4679   }
4680   _TIFFfree(obuf);   4680   _TIFFfree(obuf);
4681   return (1);   4681   return (1);
4682 }   4682 }
4683 }   4683 }
4684 static int writeBufferToContigTiles(TIFF *out , uint8 *buf ,   4684 static int writeBufferToContigTiles(TIFF *out , uint8 *buf ,
4685                                     uint32 imagelength , uint32 imagewidth ,   4685                                     uint32 imagelength , uint32 imagewidth ,
4686                                     tsample_t spp )   4686                                     tsample_t spp )
4687 {   4687 {
4688   uint32 imagew ;   4688   uint32 imagew ;
4689   tmsize_t tmp ;   4689   tmsize_t tmp ;
4690   uint32 tilew ;   4690   uint32 tilew ;
4691   tmsize_t tmp___0 ;   4691   tmsize_t tmp___0 ;
4692   int iskew ;   4692   int iskew ;
4693   tdata_t obuf ;   4693   tdata_t obuf ;
4694   tmsize_t tmp___1 ;   4694   tmsize_t tmp___1 ;
4695   void *tmp___2 ;   4695   void *tmp___2 ;
4696   uint8 *bufp ;   4696   uint8 *bufp ;
4697   uint32 tl ;   4697   uint32 tl ;
4698   uint32 tw ;   4698   uint32 tw ;
4699   uint32 row ;   4699   uint32 row ;
4700   uint32 nrow ;   4700   uint32 nrow ;
4701   uint32 tmp___3 ;   4701   uint32 tmp___3 ;
4702   uint32 colb ;   4702   uint32 colb ;
4703   uint32 col ;   4703   uint32 col ;
4704   uint32 width ;   4704   uint32 width ;
4705   int oskew ;   4705   int oskew ;
4706   char const   *tmp___4 ;   4706   char const   *tmp___4 ;
4707   tmsize_t tmp___5 ;   4707   tmsize_t tmp___5 ;
4708     4708  
4709   {   4709   {
4710   tmp = TIFFScanlineSize(out);   4710   tmp = TIFFScanlineSize(out);
4711   imagew = (uint32 )tmp;   4711   imagew = (uint32 )tmp;
4712   tmp___0 = TIFFTileRowSize(out);   4712   tmp___0 = TIFFTileRowSize(out);
4713   tilew = (uint32 )tmp___0;   4713   tilew = (uint32 )tmp___0;
4714   iskew = (int )(imagew - tilew);   4714   iskew = (int )(imagew - tilew);
4715   tmp___1 = TIFFTileSize(out);   4715   tmp___1 = TIFFTileSize(out);
4716   tmp___2 = _TIFFmalloc(tmp___1);   4716   tmp___2 = _TIFFmalloc(tmp___1);
4717   obuf = tmp___2;   4717   obuf = tmp___2;
4718   bufp = buf;   4718   bufp = buf;
4719   if ((unsigned int )obuf == (unsigned int )((void *)0)) {   4719   if ((unsigned int )obuf == (unsigned int )((void *)0)) {
4720     return (0);   4720     return (0);
4721   } else {   4721   } else {
4722     4722  
4723   }   4723   }
4724   TIFFGetField(out, (uint32 )323, & tl);   4724   TIFFGetField(out, (uint32 )323, & tl);
4725   TIFFGetField(out, (uint32 )322, & tw);   4725   TIFFGetField(out, (uint32 )322, & tw);
4726   row = (uint32 )0;   4726   row = (uint32 )0;
4727   while (row < imagelength) {   4727   while (row < imagelength) {
4728     if (row + tl > imagelength) {   4728     if (row + tl > imagelength) {
4729       tmp___3 = imagelength - row;   4729       tmp___3 = imagelength - row;
4730     } else {   4730     } else {
4731       tmp___3 = tl;   4731       tmp___3 = tl;
4732     }   4732     }
4733     nrow = tmp___3;   4733     nrow = tmp___3;
4734     colb = (uint32 )0;   4734     colb = (uint32 )0;
4735     col = (uint32 )0;   4735     col = (uint32 )0;
4736     while (col < imagewidth) {   4736     while (col < imagewidth) {
4737       if (colb + tilew > imagew) {   4737       if (colb + tilew > imagew) {
4738         width = imagew - colb;   4738         width = imagew - colb;
4739         oskew = (int )(tilew - width);   4739         oskew = (int )(tilew - width);
4740         cpStripToTile((uint8 *)obuf, bufp + colb, nrow, width, oskew,   4740         cpStripToTile((uint8 *)obuf, bufp + colb, nrow, width, oskew,
4741                       oskew + iskew);   4741                       oskew + iskew);
4742       } else {   4742       } else {
4743         cpStripToTile((uint8 *)obuf, bufp + colb, nrow, tilew, 0, iskew);   4743         cpStripToTile((uint8 *)obuf, bufp + colb, nrow, tilew, 0, iskew);
4744       }   4744       }
4745       tmp___5 = TIFFWriteTile(out, obuf, col, row, (uint32 )0, (uint16 )0);   4745       tmp___5 = TIFFWriteTile(out, obuf, col, row, (uint32 )0, (uint16 )0);
4746       if (tmp___5 < 0L) {   4746       if (tmp___5 < 0L) {
4747         tmp___4 = TIFFFileName(out);   4747         tmp___4 = TIFFFileName(out);
4748         TIFFError(tmp___4, "Error, can\'t write tile at %lu %lu",   4748         TIFFError(tmp___4, "Error, can\'t write tile at %lu %lu",
4749                   (unsigned long )col, (unsigned long )row);   4749                   (unsigned long )col, (unsigned long )row);
4750         _TIFFfree(obuf);   4750         _TIFFfree(obuf);
4751         return (0);   4751         return (0);
4752       } else {   4752       } else {
4753     4753  
4754       }   4754       }
4755       colb += tilew;   4755       colb += tilew;
4756       col += tw;   4756       col += tw;
4757     }   4757     }
4758     bufp += nrow * imagew;   4758     bufp += nrow * imagew;
4759     row += tilelength;   4759     row += tilelength;
4760   }   4760   }
4761   _TIFFfree(obuf);   4761   _TIFFfree(obuf);
4762   return (1);   4762   return (1);
4763 }   4763 }
4764 }   4764 }
4765 static int writeBufferToSeparateTiles(TIFF *out , uint8 *buf ,   4765 static int writeBufferToSeparateTiles(TIFF *out , uint8 *buf ,
4766                                       uint32 imagelength , uint32 imagewidth ,   4766                                       uint32 imagelength , uint32 imagewidth ,
4767                                       tsample_t spp , struct dump_opts *dump )   4767                                       tsample_t spp , struct dump_opts *dump )
4768 {   4768 {
4769   uint32 imagew ;   4769   uint32 imagew ;
4770   tmsize_t tmp ;   4770   tmsize_t tmp ;
4771   tsize_t tilew ;   4771   tsize_t tilew ;
4772   tmsize_t tmp___0 ;   4772   tmsize_t tmp___0 ;
4773   uint32 iimagew ;   4773   uint32 iimagew ;
4774   tmsize_t tmp___1 ;   4774   tmsize_t tmp___1 ;
4775   int iskew ;   4775   int iskew ;
4776   tdata_t obuf ;   4776   tdata_t obuf ;
4777   tmsize_t tmp___2 ;   4777   tmsize_t tmp___2 ;
4778   void *tmp___3 ;   4778   void *tmp___3 ;
4779   uint8 *bufp ;   4779   uint8 *bufp ;
4780   uint32 tl ;   4780   uint32 tl ;
4781   uint32 tw ;   4781   uint32 tw ;
4782   uint32 row ;   4782   uint32 row ;
4783   uint16 bps ;   4783   uint16 bps ;
4784   uint16 bytes_per_sample ;   4784   uint16 bytes_per_sample ;
4785   uint32 nrow ;   4785   uint32 nrow ;
4786   uint32 tmp___4 ;   4786   uint32 tmp___4 ;
4787   uint32 colb ;   4787   uint32 colb ;
4788   uint32 col ;   4788   uint32 col ;
4789   tsample_t s ;   4789   tsample_t s ;
4790   uint32 width ;   4790   uint32 width ;
4791   int oskew ;   4791   int oskew ;
4792   char const   *tmp___5 ;   4792   char const   *tmp___5 ;
4793   tmsize_t tmp___6 ;   4793   tmsize_t tmp___6 ;
4794     4794  
4795   {   4795   {
4796   tmp = TIFFScanlineSize(out);   4796   tmp = TIFFScanlineSize(out);
4797   imagew = (uint32 )tmp;   4797   imagew = (uint32 )tmp;
4798   tmp___0 = TIFFTileRowSize(out);   4798   tmp___0 = TIFFTileRowSize(out);
4799   tilew = tmp___0;   4799   tilew = tmp___0;
4800   tmp___1 = TIFFRasterScanlineSize(out);   4800   tmp___1 = TIFFRasterScanlineSize(out);
4801   iimagew = (uint32 )tmp___1;   4801   iimagew = (uint32 )tmp___1;
4802   iskew = (int )((unsigned long )iimagew - (unsigned long )(tilew * (tsize_t )spp));   4802   iskew = (int )((unsigned long )iimagew - (unsigned long )(tilew * (tsize_t )spp));
4803   tmp___2 = TIFFTileSize(out);   4803   tmp___2 = TIFFTileSize(out);
4804   tmp___3 = _TIFFmalloc(tmp___2);   4804   tmp___3 = _TIFFmalloc(tmp___2);
4805   obuf = tmp___3;   4805   obuf = tmp___3;
4806   bufp = buf;   4806   bufp = buf;
4807   if ((unsigned int )obuf == (unsigned int )((void *)0)) {   4807   if ((unsigned int )obuf == (unsigned int )((void *)0)) {
4808     return (0);   4808     return (0);
4809   } else {   4809   } else {
4810     4810  
4811   }   4811   }
4812   TIFFGetField(out, (uint32 )323, & tl);   4812   TIFFGetField(out, (uint32 )323, & tl);
4813   TIFFGetField(out, (uint32 )322, & tw);   4813   TIFFGetField(out, (uint32 )322, & tw);
4814   TIFFGetField(out, (uint32 )258, & bps);   4814   TIFFGetField(out, (uint32 )258, & bps);
4815   if ((int )bps % 8 == 0) {   4815   if ((int )bps % 8 == 0) {
4816     4816  
4817   } else {   4817   } else {
4818     __assert_fail("bps % 8 == 0", "tiffcrop.c", 1053U,   4818     __assert_fail("bps % 8 == 0", "tiffcrop.c", 1053U,
4819                   "writeBufferToSeparateTiles");   4819                   "writeBufferToSeparateTiles");
4820   }   4820   }
4821   bytes_per_sample = (uint16 )(((int )bps + 7) / 8);   4821   bytes_per_sample = (uint16 )(((int )bps + 7) / 8);
4822   row = (uint32 )0;   4822   row = (uint32 )0;
4823   while (row < imagelength) {   4823   while (row < imagelength) {
4824     if (row + tl > imagelength) {   4824     if (row + tl > imagelength) {
4825       tmp___4 = imagelength - row;   4825       tmp___4 = imagelength - row;
4826     } else {   4826     } else {
4827       tmp___4 = tl;   4827       tmp___4 = tl;
4828     }   4828     }
4829     nrow = tmp___4;   4829     nrow = tmp___4;
4830     colb = (uint32 )0;   4830     colb = (uint32 )0;
4831     col = (uint32 )0;   4831     col = (uint32 )0;
4832     while (col < imagewidth) {   4832     while (col < imagewidth) {
4833       s = (tsample_t )0;   4833       s = (tsample_t )0;
4834       while ((int )s < (int )spp) {   4834       while ((int )s < (int )spp) {
4835         if ((unsigned long )colb + (unsigned long )tilew > (unsigned long )imagew) {   4835         if ((unsigned long )colb + (unsigned long )tilew > (unsigned long )imagew) {
4836           width = imagew - colb;   4836           width = imagew - colb;
4837           oskew = (int )((unsigned long )tilew - (unsigned long )width);   4837           oskew = (int )((unsigned long )tilew - (unsigned long )width);
4838           extractContigSamplesToBuffer((uint8 *)obuf,   4838           extractContigSamplesToBuffer((uint8 *)obuf,
4839                                        (bufp + colb * (uint32 )spp) + (int )s,   4839                                        (bufp + colb * (uint32 )spp) + (int )s,
4840                                        nrow, width / (uint32 )bytes_per_sample,   4840                                        nrow, width / (uint32 )bytes_per_sample,
4841                                        oskew, oskew * (int )spp + iskew, s, spp,   4841                                        oskew, oskew * (int )spp + iskew, s, spp,
4842                                        bps, dump);   4842                                        bps, dump);
4843         } else {   4843         } else {
4844           extractContigSamplesToBuffer((uint8 *)obuf,   4844           extractContigSamplesToBuffer((uint8 *)obuf,
4845                                        (bufp + colb * (uint32 )spp) + (int )s,   4845                                        (bufp + colb * (uint32 )spp) + (int )s,
4846                                        nrow, tilewidth, 0, iskew, s, spp, bps,   4846                                        nrow, tilewidth, 0, iskew, s, spp, bps,
4847                                        dump);   4847                                        dump);
4848         }   4848         }
4849         tmp___6 = TIFFWriteTile(out, obuf, col, row, (uint32 )0, s);   4849         tmp___6 = TIFFWriteTile(out, obuf, col, row, (uint32 )0, s);
4850         if (tmp___6 < 0L) {   4850         if (tmp___6 < 0L) {
4851           tmp___5 = TIFFFileName(out);   4851           tmp___5 = TIFFFileName(out);
4852           TIFFError(tmp___5, "Error, can\'t write tile at %lu %lu sample %lu",   4852           TIFFError(tmp___5, "Error, can\'t write tile at %lu %lu sample %lu",
4853                     (unsigned long )col, (unsigned long )row, (unsigned long )s);   4853                     (unsigned long )col, (unsigned long )row, (unsigned long )s);
4854           _TIFFfree(obuf);   4854           _TIFFfree(obuf);
4855           return (0);   4855           return (0);
4856         } else {   4856         } else {
4857     4857  
4858         }   4858         }
4859         s = (tsample_t )((int )s + 1);   4859         s = (tsample_t )((int )s + 1);
4860       }   4860       }
4861       colb = (uint32 )((unsigned long )colb + (unsigned long )tilew);   4861       colb = (uint32 )((unsigned long )colb + (unsigned long )tilew);
4862       col += tw;   4862       col += tw;
4863     }   4863     }
4864     bufp += nrow * iimagew;   4864     bufp += nrow * iimagew;
4865     row += tl;   4865     row += tl;
4866   }   4866   }
4867   _TIFFfree(obuf);   4867   _TIFFfree(obuf);
4868   return (1);   4868   return (1);
4869 }   4869 }
4870 }   4870 }
4871 static void processG3Options(char *cp )   4871 static void processG3Options(char *cp )
4872 {   4872 {
4873   size_t tmp ;   4873   size_t tmp ;
4874   size_t tmp___0 ;   4874   size_t tmp___0 ;
4875   size_t __s1_len ;   4875   size_t __s1_len ;
4876   size_t __s2_len ;   4876   size_t __s2_len ;
4877   int tmp___1 ;   4877   int tmp___1 ;
4878   int tmp___2 ;   4878   int tmp___2 ;
4879   int tmp___3 ;   4879   int tmp___3 ;
4880   unsigned char const   *__s2 ;   4880   unsigned char const   *__s2 ;
4881   register int __result ;   4881   register int __result ;
4882   int tmp___4 ;   4882   int tmp___4 ;
4883   unsigned char const   *__s1 ;   4883   unsigned char const   *__s1 ;
4884   register int __result___0 ;   4884   register int __result___0 ;
4885   int tmp___5 ;   4885   int tmp___5 ;
4886   int tmp___6 ;   4886   int tmp___6 ;
4887   int tmp___7 ;   4887   int tmp___7 ;
4888   int tmp___8 ;   4888   int tmp___8 ;
4889   int tmp___9 ;   4889   int tmp___9 ;
4890   size_t tmp___10 ;   4890   size_t tmp___10 ;
4891   size_t tmp___11 ;   4891   size_t tmp___11 ;
4892   size_t tmp___12 ;   4892   size_t tmp___12 ;
4893   size_t tmp___13 ;   4893   size_t tmp___13 ;
4894   size_t __s1_len___0 ;   4894   size_t __s1_len___0 ;
4895   size_t __s2_len___0 ;   4895   size_t __s2_len___0 ;
4896   int tmp___14 ;   4896   int tmp___14 ;
4897   int tmp___15 ;   4897   int tmp___15 ;
4898   int tmp___16 ;   4898   int tmp___16 ;
4899   unsigned char const   *__s2___0 ;   4899   unsigned char const   *__s2___0 ;
4900   register int __result___1 ;   4900   register int __result___1 ;
4901   int tmp___17 ;   4901   int tmp___17 ;
4902   unsigned char const   *__s1___0 ;   4902   unsigned char const   *__s1___0 ;
4903   register int __result___2 ;   4903   register int __result___2 ;
4904   int tmp___18 ;   4904   int tmp___18 ;
4905   int tmp___19 ;   4905   int tmp___19 ;
4906   int tmp___20 ;   4906   int tmp___20 ;
4907   int tmp___21 ;   4907   int tmp___21 ;
4908   int tmp___22 ;   4908   int tmp___22 ;
4909   size_t tmp___23 ;   4909   size_t tmp___23 ;
4910   size_t tmp___24 ;   4910   size_t tmp___24 ;
4911   size_t tmp___25 ;   4911   size_t tmp___25 ;
4912   size_t tmp___26 ;   4912   size_t tmp___26 ;
4913   size_t __s1_len___1 ;   4913   size_t __s1_len___1 ;
4914   size_t __s2_len___1 ;   4914   size_t __s2_len___1 ;
4915   int tmp___27 ;   4915   int tmp___27 ;
4916   int tmp___28 ;   4916   int tmp___28 ;
4917   int tmp___29 ;   4917   int tmp___29 ;
4918   unsigned char const   *__s2___1 ;   4918   unsigned char const   *__s2___1 ;
4919   register int __result___3 ;   4919   register int __result___3 ;
4920   int tmp___30 ;   4920   int tmp___30 ;
4921   unsigned char const   *__s1___1 ;   4921   unsigned char const   *__s1___1 ;
4922   register int __result___4 ;   4922   register int __result___4 ;
4923   int tmp___31 ;   4923   int tmp___31 ;
4924   int tmp___32 ;   4924   int tmp___32 ;
4925   int tmp___33 ;   4925   int tmp___33 ;
4926   int tmp___34 ;   4926   int tmp___34 ;
4927   int tmp___35 ;   4927   int tmp___35 ;
4928   size_t tmp___36 ;   4928   size_t tmp___36 ;
4929   size_t tmp___37 ;   4929   size_t tmp___37 ;
4930   void *tmp___38 ;   4930   void *tmp___38 ;
4931   char *tmp___39 ;   4931   char *tmp___39 ;
4932   void *tmp___40 ;   4932   void *tmp___40 ;
4933   char *tmp___41 ;   4933   char *tmp___41 ;
4934     4934  
4935   {   4935   {
4936   tmp___41 = __builtin_strchr(cp, ':');   4936   tmp___41 = __builtin_strchr(cp, ':');
4937   cp = tmp___41;   4937   cp = tmp___41;
4938   if (cp) {   4938   if (cp) {
4939     if (defg3opts == 4294967295U) {   4939     if (defg3opts == 4294967295U) {
4940       defg3opts = (uint32 )0;   4940       defg3opts = (uint32 )0;
4941     } else {   4941     } else {
4942     4942  
4943     }   4943     }
4944     while (1) {   4944     while (1) {
4945       cp ++;   4945       cp ++;
4946       if (0) {   4946       if (0) {
4947         if (0) {   4947         if (0) {
4948           __s1_len___1 = strlen((char const   *)cp);   4948           __s1_len___1 = strlen((char const   *)cp);
4949           __s2_len___1 = strlen("1d");   4949           __s2_len___1 = strlen("1d");
4950           if (! ((size_t )((void const   *)(cp + 1)) - (size_t )((void const   *)cp) == 1U)) {   4950           if (! ((size_t )((void const   *)(cp + 1)) - (size_t )((void const   *)cp) == 1U)) {
4951             goto _L___4;   4951             goto _L___4;
4952           } else   4952           } else
4953           if (__s1_len___1 >= 4U) {   4953           if (__s1_len___1 >= 4U) {
4954             _L___4: /* CIL Label */   4954             _L___4: /* CIL Label */
4955             if (! ((size_t )((void const   *)("1d" + 1)) - (size_t )((void const   *)"1d") == 1U)) {   4955             if (! ((size_t )((void const   *)("1d" + 1)) - (size_t )((void const   *)"1d") == 1U)) {
4956               tmp___33 = 1;   4956               tmp___33 = 1;
4957             } else   4957             } else
4958             if (__s2_len___1 >= 4U) {   4958             if (__s2_len___1 >= 4U) {
4959               tmp___33 = 1;   4959               tmp___33 = 1;
4960             } else {   4960             } else {
4961               tmp___33 = 0;   4961               tmp___33 = 0;
4962             }   4962             }
4963           } else {   4963           } else {
4964             tmp___33 = 0;   4964             tmp___33 = 0;
4965           }   4965           }
4966           if (tmp___33) {   4966           if (tmp___33) {
4967             tmp___28 = __builtin_strcmp((char const   *)cp, "1d");   4967             tmp___28 = __builtin_strcmp((char const   *)cp, "1d");
4968             tmp___32 = tmp___28;   4968             tmp___32 = tmp___28;
4969           } else {   4969           } else {
4970             tmp___31 = __builtin_strcmp((char const   *)cp, "1d");   4970             tmp___31 = __builtin_strcmp((char const   *)cp, "1d");
4971             tmp___32 = tmp___31;   4971             tmp___32 = tmp___31;
4972           }   4972           }
4973         } else {   4973         } else {
4974           tmp___31 = __builtin_strcmp((char const   *)cp, "1d");   4974           tmp___31 = __builtin_strcmp((char const   *)cp, "1d");
4975           tmp___32 = tmp___31;   4975           tmp___32 = tmp___31;
4976         }   4976         }
4977         tmp___35 = tmp___32;   4977         tmp___35 = tmp___32;
4978       } else {   4978       } else {
4979         tmp___34 = strncmp((char const   *)cp, "1d", (size_t )2);   4979         tmp___34 = strncmp((char const   *)cp, "1d", (size_t )2);
4980         tmp___35 = tmp___34;   4980         tmp___35 = tmp___34;
4981       }   4981       }
4982       if (tmp___35 == 0) {   4982       if (tmp___35 == 0) {
4983         defg3opts &= 4294967294U;   4983         defg3opts &= 4294967294U;
4984       } else {   4984       } else {
4985         if (0) {   4985         if (0) {
4986           if (0) {   4986           if (0) {
4987             __s1_len___0 = strlen((char const   *)cp);   4987             __s1_len___0 = strlen((char const   *)cp);
4988             __s2_len___0 = strlen("2d");   4988             __s2_len___0 = strlen("2d");
4989             if (! ((size_t )((void const   *)(cp + 1)) - (size_t )((void const   *)cp) == 1U)) {   4989             if (! ((size_t )((void const   *)(cp + 1)) - (size_t )((void const   *)cp) == 1U)) {
4990               goto _L___2;   4990               goto _L___2;
4991             } else   4991             } else
4992             if (__s1_len___0 >= 4U) {   4992             if (__s1_len___0 >= 4U) {
4993               _L___2: /* CIL Label */   4993               _L___2: /* CIL Label */
4994               if (! ((size_t )((void const   *)("2d" + 1)) - (size_t )((void const   *)"2d") == 1U)) {   4994               if (! ((size_t )((void const   *)("2d" + 1)) - (size_t )((void const   *)"2d") == 1U)) {
4995                 tmp___20 = 1;   4995                 tmp___20 = 1;
4996               } else   4996               } else
4997               if (__s2_len___0 >= 4U) {   4997               if (__s2_len___0 >= 4U) {
4998                 tmp___20 = 1;   4998                 tmp___20 = 1;
4999               } else {   4999               } else {
5000                 tmp___20 = 0;   5000                 tmp___20 = 0;
5001               }   5001               }
5002             } else {   5002             } else {
5003               tmp___20 = 0;   5003               tmp___20 = 0;
5004             }   5004             }
5005             if (tmp___20) {   5005             if (tmp___20) {
5006               tmp___15 = __builtin_strcmp((char const   *)cp, "2d");   5006               tmp___15 = __builtin_strcmp((char const   *)cp, "2d");
5007               tmp___19 = tmp___15;   5007               tmp___19 = tmp___15;
5008             } else {   5008             } else {
5009               tmp___18 = __builtin_strcmp((char const   *)cp, "2d");   5009               tmp___18 = __builtin_strcmp((char const   *)cp, "2d");
5010               tmp___19 = tmp___18;   5010               tmp___19 = tmp___18;
5011             }   5011             }
5012           } else {   5012           } else {
5013             tmp___18 = __builtin_strcmp((char const   *)cp, "2d");   5013             tmp___18 = __builtin_strcmp((char const   *)cp, "2d");
5014             tmp___19 = tmp___18;   5014             tmp___19 = tmp___18;
5015           }   5015           }
5016           tmp___22 = tmp___19;   5016           tmp___22 = tmp___19;
5017         } else {   5017         } else {
5018           tmp___21 = strncmp((char const   *)cp, "2d", (size_t )2);   5018           tmp___21 = strncmp((char const   *)cp, "2d", (size_t )2);
5019           tmp___22 = tmp___21;   5019           tmp___22 = tmp___21;
5020         }   5020         }
5021         if (tmp___22 == 0) {   5021         if (tmp___22 == 0) {
5022           defg3opts |= 1U;   5022           defg3opts |= 1U;
5023         } else {   5023         } else {
5024           if (0) {   5024           if (0) {
5025             if (0) {   5025             if (0) {
5026               __s1_len = strlen((char const   *)cp);   5026               __s1_len = strlen((char const   *)cp);
5027               __s2_len = strlen("fill");   5027               __s2_len = strlen("fill");
5028               if (! ((size_t )((void const   *)(cp + 1)) - (size_t )((void const   *)cp) == 1U)) {   5028               if (! ((size_t )((void const   *)(cp + 1)) - (size_t )((void const   *)cp) == 1U)) {
5029                 goto _L___0;   5029                 goto _L___0;
5030               } else   5030               } else
5031               if (__s1_len >= 4U) {   5031               if (__s1_len >= 4U) {
5032                 _L___0: /* CIL Label */   5032                 _L___0: /* CIL Label */
5033                 if (! ((size_t )((void const   *)("fill" + 1)) - (size_t )((void const   *)"fill") == 1U)) {   5033                 if (! ((size_t )((void const   *)("fill" + 1)) - (size_t )((void const   *)"fill") == 1U)) {
5034                   tmp___7 = 1;   5034                   tmp___7 = 1;
5035                 } else   5035                 } else
5036                 if (__s2_len >= 4U) {   5036                 if (__s2_len >= 4U) {
5037                   tmp___7 = 1;   5037                   tmp___7 = 1;
5038                 } else {   5038                 } else {
5039                   tmp___7 = 0;   5039                   tmp___7 = 0;
5040                 }   5040                 }
5041               } else {   5041               } else {
5042                 tmp___7 = 0;   5042                 tmp___7 = 0;
5043               }   5043               }
5044               if (tmp___7) {   5044               if (tmp___7) {
5045                 tmp___2 = __builtin_strcmp((char const   *)cp, "fill");   5045                 tmp___2 = __builtin_strcmp((char const   *)cp, "fill");
5046                 tmp___6 = tmp___2;   5046                 tmp___6 = tmp___2;
5047               } else {   5047               } else {
5048                 tmp___5 = __builtin_strcmp((char const   *)cp, "fill");   5048                 tmp___5 = __builtin_strcmp((char const   *)cp, "fill");
5049                 tmp___6 = tmp___5;   5049                 tmp___6 = tmp___5;
5050               }   5050               }
5051             } else {   5051             } else {
5052               tmp___5 = __builtin_strcmp((char const   *)cp, "fill");   5052               tmp___5 = __builtin_strcmp((char const   *)cp, "fill");
5053               tmp___6 = tmp___5;   5053               tmp___6 = tmp___5;
5054             }   5054             }
5055             tmp___9 = tmp___6;   5055             tmp___9 = tmp___6;
5056           } else {   5056           } else {
5057             tmp___8 = strncmp((char const   *)cp, "fill", (size_t )4);   5057             tmp___8 = strncmp((char const   *)cp, "fill", (size_t )4);
5058             tmp___9 = tmp___8;   5058             tmp___9 = tmp___8;
5059           }   5059           }
5060           if (tmp___9 == 0) {   5060           if (tmp___9 == 0) {
5061             defg3opts |= 4U;   5061             defg3opts |= 4U;
5062           } else {   5062           } else {
5063             usage();   5063             usage();
5064           }   5064           }
5065         }   5065         }
5066       }   5066       }
5067       tmp___39 = __builtin_strchr(cp, ':');   5067       tmp___39 = __builtin_strchr(cp, ':');
5068       cp = tmp___39;   5068       cp = tmp___39;
5069       if (cp) {   5069       if (cp) {
5070     5070  
5071       } else {   5071       } else {
5072         break;   5072         break;
5073       }   5073       }
5074     }   5074     }
5075   } else {   5075   } else {
5076     5076  
5077   }   5077   }
5078   return;   5078   return;
5079 }   5079 }
5080 }   5080 }
5081 static int processCompressOptions(char *opt )   5081 static int processCompressOptions(char *opt )
5082 {   5082 {
5083   char *cp ;   5083   char *cp ;
5084   void *tmp ;   5084   void *tmp ;
5085   char *tmp___0 ;   5085   char *tmp___0 ;
5086   unsigned short const   **tmp___1 ;   5086   unsigned short const   **tmp___1 ;
5087   void *tmp___2 ;   5087   void *tmp___2 ;
5088   char *tmp___3 ;   5088   char *tmp___3 ;
5089   char *cp___0 ;   5089   char *cp___0 ;
5090   void *tmp___4 ;   5090   void *tmp___4 ;
5091   char *tmp___5 ;   5091   char *tmp___5 ;
5092   int tmp___6 ;   5092   int tmp___6 ;
5093   char *cp___1 ;   5093   char *cp___1 ;
5094   void *tmp___7 ;   5094   void *tmp___7 ;
5095   char *tmp___8 ;   5095   char *tmp___8 ;
5096   int tmp___9 ;   5096   int tmp___9 ;
5097   size_t tmp___10 ;   5097   size_t tmp___10 ;
5098   size_t tmp___11 ;   5098   size_t tmp___11 ;
5099   size_t __s1_len ;   5099   size_t __s1_len ;
5100   size_t __s2_len ;   5100   size_t __s2_len ;
5101   int tmp___12 ;   5101   int tmp___12 ;
5102   int tmp___13 ;   5102   int tmp___13 ;
5103   int tmp___14 ;   5103   int tmp___14 ;
5104   unsigned char const   *__s2 ;   5104   unsigned char const   *__s2 ;
5105   register int __result ;   5105   register int __result ;
5106   int tmp___15 ;   5106   int tmp___15 ;
5107   unsigned char const   *__s1 ;   5107   unsigned char const   *__s1 ;
5108   register int __result___0 ;   5108   register int __result___0 ;
5109   int tmp___16 ;   5109   int tmp___16 ;
5110   int tmp___17 ;   5110   int tmp___17 ;
5111   int tmp___18 ;   5111   int tmp___18 ;
5112   int tmp___19 ;   5112   int tmp___19 ;
5113   int tmp___20 ;   5113   int tmp___20 ;
5114   size_t tmp___21 ;   5114   size_t tmp___21 ;
5115   size_t tmp___22 ;   5115   size_t tmp___22 ;
5116   size_t tmp___23 ;   5116   size_t tmp___23 ;
5117   size_t tmp___24 ;   5117   size_t tmp___24 ;
5118   size_t __s1_len___0 ;   5118   size_t __s1_len___0 ;
5119   size_t __s2_len___0 ;   5119   size_t __s2_len___0 ;
5120   int tmp___25 ;   5120   int tmp___25 ;
5121   int tmp___26 ;   5121   int tmp___26 ;
5122   int tmp___27 ;   5122   int tmp___27 ;
5123   unsigned char const   *__s2___0 ;   5123   unsigned char const   *__s2___0 ;
5124   register int __result___1 ;   5124   register int __result___1 ;
5125   int tmp___28 ;   5125   int tmp___28 ;
5126   unsigned char const   *__s1___0 ;   5126   unsigned char const   *__s1___0 ;
5127   register int __result___2 ;   5127   register int __result___2 ;
5128   int tmp___29 ;   5128   int tmp___29 ;
5129   int tmp___30 ;   5129   int tmp___30 ;
5130   int tmp___31 ;   5130   int tmp___31 ;
5131   int tmp___32 ;   5131   int tmp___32 ;
5132   int tmp___33 ;   5132   int tmp___33 ;
5133   size_t tmp___34 ;   5133   size_t tmp___34 ;
5134   size_t tmp___35 ;   5134   size_t tmp___35 ;
5135   size_t __s1_len___1 ;   5135   size_t __s1_len___1 ;
5136   size_t __s2_len___1 ;   5136   size_t __s2_len___1 ;
5137   int tmp___36 ;   5137   int tmp___36 ;
5138   int tmp___37 ;   5138   int tmp___37 ;
5139   int tmp___38 ;   5139   int tmp___38 ;
5140   unsigned char const   *__s2___1 ;   5140   unsigned char const   *__s2___1 ;
5141   register int __result___3 ;   5141   register int __result___3 ;
5142   int tmp___39 ;   5142   int tmp___39 ;
5143   unsigned char const   *__s1___1 ;   5143   unsigned char const   *__s1___1 ;
5144   register int __result___4 ;   5144   register int __result___4 ;
5145   int tmp___40 ;   5145   int tmp___40 ;
5146   int tmp___41 ;   5146   int tmp___41 ;
5147   int tmp___42 ;   5147   int tmp___42 ;
5148   size_t tmp___43 ;   5148   size_t tmp___43 ;
5149   size_t tmp___44 ;   5149   size_t tmp___44 ;
5150   size_t __s1_len___2 ;   5150   size_t __s1_len___2 ;
5151   size_t __s2_len___2 ;   5151   size_t __s2_len___2 ;
5152   int tmp___45 ;   5152   int tmp___45 ;
5153   int tmp___46 ;   5153   int tmp___46 ;
5154   int tmp___47 ;   5154   int tmp___47 ;
5155   unsigned char const   *__s2___2 ;   5155   unsigned char const   *__s2___2 ;
5156   register int __result___5 ;   5156   register int __result___5 ;
5157   int tmp___48 ;   5157   int tmp___48 ;
5158   unsigned char const   *__s1___2 ;   5158   unsigned char const   *__s1___2 ;
5159   register int __result___6 ;   5159   register int __result___6 ;
5160   int tmp___49 ;   5160   int tmp___49 ;
5161   int tmp___50 ;   5161   int tmp___50 ;
5162   int tmp___51 ;   5162   int tmp___51 ;
5163   int tmp___52 ;   5163   int tmp___52 ;
5164   int tmp___53 ;   5164   int tmp___53 ;
5165   size_t tmp___54 ;   5165   size_t tmp___54 ;
5166   size_t tmp___55 ;   5166   size_t tmp___55 ;
5167   size_t tmp___56 ;   5167   size_t tmp___56 ;
5168   size_t tmp___57 ;   5168   size_t tmp___57 ;
5169   size_t __s1_len___3 ;   5169   size_t __s1_len___3 ;
5170   size_t __s2_len___3 ;   5170   size_t __s2_len___3 ;
5171   int tmp___58 ;   5171   int tmp___58 ;
5172   int tmp___59 ;   5172   int tmp___59 ;
5173   int tmp___60 ;   5173   int tmp___60 ;
5174   unsigned char const   *__s2___3 ;   5174   unsigned char const   *__s2___3 ;
5175   register int __result___7 ;   5175   register int __result___7 ;
5176   int tmp___61 ;   5176   int tmp___61 ;
5177   unsigned char const   *__s1___3 ;   5177   unsigned char const   *__s1___3 ;
5178   register int __result___8 ;   5178   register int __result___8 ;
5179   int tmp___62 ;   5179   int tmp___62 ;
5180   int tmp___63 ;   5180   int tmp___63 ;
5181   int tmp___64 ;   5181   int tmp___64 ;
5182   int tmp___65 ;   5182   int tmp___65 ;
5183   int tmp___66 ;   5183   int tmp___66 ;
5184   size_t tmp___67 ;   5184   size_t tmp___67 ;
5185   size_t tmp___68 ;   5185   size_t tmp___68 ;
5186   size_t __s1_len___4 ;   5186   size_t __s1_len___4 ;
5187   size_t __s2_len___4 ;   5187   size_t __s2_len___4 ;
5188   int tmp___69 ;   5188   int tmp___69 ;
5189   int tmp___70 ;   5189   int tmp___70 ;
5190   int tmp___71 ;   5190   int tmp___71 ;
5191   unsigned char const   *__s2___4 ;   5191   unsigned char const   *__s2___4 ;
5192   register int __result___9 ;   5192   register int __result___9 ;
5193   int tmp___72 ;   5193   int tmp___72 ;
5194   unsigned char const   *__s1___4 ;   5194   unsigned char const   *__s1___4 ;
5195   register int __result___10 ;   5195   register int __result___10 ;
5196   int tmp___73 ;   5196   int tmp___73 ;
5197   int tmp___74 ;   5197   int tmp___74 ;
5198   int tmp___75 ;   5198   int tmp___75 ;
5199   size_t __s1_len___5 ;   5199   size_t __s1_len___5 ;
5200   size_t __s2_len___5 ;   5200   size_t __s2_len___5 ;
5201   int tmp___76 ;   5201   int tmp___76 ;
5202   int tmp___77 ;   5202   int tmp___77 ;
5203   int tmp___78 ;   5203   int tmp___78 ;
5204   unsigned char const   *__s2___5 ;   5204   unsigned char const   *__s2___5 ;
5205   register int __result___11 ;   5205   register int __result___11 ;
5206   int tmp___79 ;   5206   int tmp___79 ;
5207   unsigned char const   *__s1___5 ;   5207   unsigned char const   *__s1___5 ;
5208   register int __result___12 ;   5208   register int __result___12 ;
5209   int tmp___80 ;   5209   int tmp___80 ;
5210   int tmp___81 ;   5210   int tmp___81 ;
5211   int tmp___82 ;   5211   int tmp___82 ;
5212     5212  
5213   {   5213   {
5214   if (0) {   5214   if (0) {
5215     __s1_len___5 = strlen((char const   *)opt);   5215     __s1_len___5 = strlen((char const   *)opt);
5216     __s2_len___5 = strlen("none");   5216     __s2_len___5 = strlen("none");
5217     if (! ((size_t )((void const   *)(opt + 1)) - (size_t )((void const   *)opt) == 1U)) {   5217     if (! ((size_t )((void const   *)(opt + 1)) - (size_t )((void const   *)opt) == 1U)) {
5218       goto _L___12;   5218       goto _L___12;
5219     } else   5219     } else
5220     if (__s1_len___5 >= 4U) {   5220     if (__s1_len___5 >= 4U) {
5221       _L___12: /* CIL Label */   5221       _L___12: /* CIL Label */
5222       if (! ((size_t )((void const   *)("none" + 1)) - (size_t )((void const   *)"none") == 1U)) {   5222       if (! ((size_t )((void const   *)("none" + 1)) - (size_t )((void const   *)"none") == 1U)) {
5223         tmp___82 = 1;   5223         tmp___82 = 1;
5224       } else   5224       } else
5225       if (__s2_len___5 >= 4U) {   5225       if (__s2_len___5 >= 4U) {
5226         tmp___82 = 1;   5226         tmp___82 = 1;
5227       } else {   5227       } else {
5228         tmp___82 = 0;   5228         tmp___82 = 0;
5229       }   5229       }
5230     } else {   5230     } else {
5231       tmp___82 = 0;   5231       tmp___82 = 0;
5232     }   5232     }
5233     if (tmp___82) {   5233     if (tmp___82) {
5234       tmp___77 = __builtin_strcmp((char const   *)opt, "none");   5234       tmp___77 = __builtin_strcmp((char const   *)opt, "none");
5235       tmp___81 = tmp___77;   5235       tmp___81 = tmp___77;
5236     } else {   5236     } else {
5237       tmp___80 = __builtin_strcmp((char const   *)opt, "none");   5237       tmp___80 = __builtin_strcmp((char const   *)opt, "none");
5238       tmp___81 = tmp___80;   5238       tmp___81 = tmp___80;
5239     }   5239     }
5240   } else {   5240   } else {
5241     tmp___80 = __builtin_strcmp((char const   *)opt, "none");   5241     tmp___80 = __builtin_strcmp((char const   *)opt, "none");
5242     tmp___81 = tmp___80;   5242     tmp___81 = tmp___80;
5243   }   5243   }
5244   if (tmp___81 == 0) {   5244   if (tmp___81 == 0) {
5245     defcompression = (uint16 )1;   5245     defcompression = (uint16 )1;
5246   } else {   5246   } else {
5247     if (0) {   5247     if (0) {
5248       __s1_len___4 = strlen((char const   *)opt);   5248       __s1_len___4 = strlen((char const   *)opt);
5249       __s2_len___4 = strlen("packbits");   5249       __s2_len___4 = strlen("packbits");
5250       if (! ((size_t )((void const   *)(opt + 1)) - (size_t )((void const   *)opt) == 1U)) {   5250       if (! ((size_t )((void const   *)(opt + 1)) - (size_t )((void const   *)opt) == 1U)) {
5251         goto _L___10;   5251         goto _L___10;
5252       } else   5252       } else
5253       if (__s1_len___4 >= 4U) {   5253       if (__s1_len___4 >= 4U) {
5254         _L___10: /* CIL Label */   5254         _L___10: /* CIL Label */
5255         if (! ((size_t )((void const   *)("packbits" + 1)) - (size_t )((void const   *)"packbits") == 1U)) {   5255         if (! ((size_t )((void const   *)("packbits" + 1)) - (size_t )((void const   *)"packbits") == 1U)) {
5256           tmp___75 = 1;   5256           tmp___75 = 1;
5257         } else   5257         } else
5258         if (__s2_len___4 >= 4U) {   5258         if (__s2_len___4 >= 4U) {
5259           tmp___75 = 1;   5259           tmp___75 = 1;
5260         } else {   5260         } else {
5261           tmp___75 = 0;   5261           tmp___75 = 0;
5262         }   5262         }
5263       } else {   5263       } else {
5264         tmp___75 = 0;   5264         tmp___75 = 0;
5265       }   5265       }
5266       if (tmp___75) {   5266       if (tmp___75) {
5267         tmp___70 = __builtin_strcmp((char const   *)opt, "packbits");   5267         tmp___70 = __builtin_strcmp((char const   *)opt, "packbits");
5268         tmp___74 = tmp___70;   5268         tmp___74 = tmp___70;
5269       } else {   5269       } else {
5270         tmp___73 = __builtin_strcmp((char const   *)opt, "packbits");   5270         tmp___73 = __builtin_strcmp((char const   *)opt, "packbits");
5271         tmp___74 = tmp___73;   5271         tmp___74 = tmp___73;
5272       }   5272       }
5273     } else {   5273     } else {
5274       tmp___73 = __builtin_strcmp((char const   *)opt, "packbits");   5274       tmp___73 = __builtin_strcmp((char const   *)opt, "packbits");
5275       tmp___74 = tmp___73;   5275       tmp___74 = tmp___73;
5276     }   5276     }
5277     if (tmp___74 == 0) {   5277     if (tmp___74 == 0) {
5278       defcompression = (uint16 )32773;   5278       defcompression = (uint16 )32773;
5279     } else {   5279     } else {
5280       if (0) {   5280       if (0) {
5281         if (0) {   5281         if (0) {
5282           __s1_len___3 = strlen((char const   *)opt);   5282           __s1_len___3 = strlen((char const   *)opt);
5283           __s2_len___3 = strlen("jpeg");   5283           __s2_len___3 = strlen("jpeg");
5284           if (! ((size_t )((void const   *)(opt + 1)) - (size_t )((void const   *)opt) == 1U)) {   5284           if (! ((size_t )((void const   *)(opt + 1)) - (size_t )((void const   *)opt) == 1U)) {
5285             goto _L___8;   5285             goto _L___8;
5286           } else   5286           } else
5287           if (__s1_len___3 >= 4U) {   5287           if (__s1_len___3 >= 4U) {
5288             _L___8: /* CIL Label */   5288             _L___8: /* CIL Label */
5289             if (! ((size_t )((void const   *)("jpeg" + 1)) - (size_t )((void const   *)"jpeg") == 1U)) {   5289             if (! ((size_t )((void const   *)("jpeg" + 1)) - (size_t )((void const   *)"jpeg") == 1U)) {
5290               tmp___64 = 1;   5290               tmp___64 = 1;
5291             } else   5291             } else
5292             if (__s2_len___3 >= 4U) {   5292             if (__s2_len___3 >= 4U) {
5293               tmp___64 = 1;   5293               tmp___64 = 1;
5294             } else {   5294             } else {
5295               tmp___64 = 0;   5295               tmp___64 = 0;
5296             }   5296             }
5297           } else {   5297           } else {
5298             tmp___64 = 0;   5298             tmp___64 = 0;
5299           }   5299           }
5300           if (tmp___64) {   5300           if (tmp___64) {
5301             tmp___59 = __builtin_strcmp((char const   *)opt, "jpeg");   5301             tmp___59 = __builtin_strcmp((char const   *)opt, "jpeg");
5302             tmp___63 = tmp___59;   5302             tmp___63 = tmp___59;
5303           } else {   5303           } else {
5304             tmp___62 = __builtin_strcmp((char const   *)opt, "jpeg");   5304             tmp___62 = __builtin_strcmp((char const   *)opt, "jpeg");
5305             tmp___63 = tmp___62;   5305             tmp___63 = tmp___62;
5306           }   5306           }
5307         } else {   5307         } else {
5308           tmp___62 = __builtin_strcmp((char const   *)opt, "jpeg");   5308           tmp___62 = __builtin_strcmp((char const   *)opt, "jpeg");
5309           tmp___63 = tmp___62;   5309           tmp___63 = tmp___62;
5310         }   5310         }
5311         tmp___66 = tmp___63;   5311         tmp___66 = tmp___63;
5312       } else {   5312       } else {
5313         tmp___65 = strncmp((char const   *)opt, "jpeg", (size_t )4);   5313         tmp___65 = strncmp((char const   *)opt, "jpeg", (size_t )4);
5314         tmp___66 = tmp___65;   5314         tmp___66 = tmp___65;
5315       }   5315       }
5316       if (tmp___66 == 0) {   5316       if (tmp___66 == 0) {
5317         tmp___0 = __builtin_strchr(opt, ':');   5317         tmp___0 = __builtin_strchr(opt, ':');
5318         cp = tmp___0;   5318         cp = tmp___0;
5319         defcompression = (uint16 )7;   5319         defcompression = (uint16 )7;
5320         while (cp) {   5320         while (cp) {
5321           tmp___1 = __ctype_b_loc();   5321           tmp___1 = __ctype_b_loc();
5322           if ((int const   )*(*tmp___1 + (int )*(cp + 1)) & 2048) {   5322           if ((int const   )*(*tmp___1 + (int )*(cp + 1)) & 2048) {
5323             quality = atoi((char const   *)(cp + 1));   5323             quality = atoi((char const   *)(cp + 1));
5324           } else   5324           } else
5325           if ((int )*(cp + 1) == 114) {   5325           if ((int )*(cp + 1) == 114) {
5326             jpegcolormode = 0;   5326             jpegcolormode = 0;
5327           } else {   5327           } else {
5328             usage();   5328             usage();
5329           }   5329           }
5330           tmp___3 = __builtin_strchr(cp + 1, ':');   5330           tmp___3 = __builtin_strchr(cp + 1, ':');
5331           cp = tmp___3;   5331           cp = tmp___3;
5332         }   5332         }
5333       } else {   5333       } else {
5334         if (0) {   5334         if (0) {
5335           if (0) {   5335           if (0) {
5336             __s1_len___2 = strlen((char const   *)opt);   5336             __s1_len___2 = strlen((char const   *)opt);
5337             __s2_len___2 = strlen("g3");   5337             __s2_len___2 = strlen("g3");
5338             if (! ((size_t )((void const   *)(opt + 1)) - (size_t )((void const   *)opt) == 1U)) {   5338             if (! ((size_t )((void const   *)(opt + 1)) - (size_t )((void const   *)opt) == 1U)) {
5339               goto _L___6;   5339               goto _L___6;
5340             } else   5340             } else
5341             if (__s1_len___2 >= 4U) {   5341             if (__s1_len___2 >= 4U) {
5342               _L___6: /* CIL Label */   5342               _L___6: /* CIL Label */
5343               if (! ((size_t )((void const   *)("g3" + 1)) - (size_t )((void const   *)"g3") == 1U)) {   5343               if (! ((size_t )((void const   *)("g3" + 1)) - (size_t )((void const   *)"g3") == 1U)) {
5344                 tmp___51 = 1;   5344                 tmp___51 = 1;
5345               } else   5345               } else
5346               if (__s2_len___2 >= 4U) {   5346               if (__s2_len___2 >= 4U) {
5347                 tmp___51 = 1;   5347                 tmp___51 = 1;
5348               } else {   5348               } else {
5349                 tmp___51 = 0;   5349                 tmp___51 = 0;
5350               }   5350               }
5351             } else {   5351             } else {
5352               tmp___51 = 0;   5352               tmp___51 = 0;
5353             }   5353             }
5354             if (tmp___51) {   5354             if (tmp___51) {
5355               tmp___46 = __builtin_strcmp((char const   *)opt, "g3");   5355               tmp___46 = __builtin_strcmp((char const   *)opt, "g3");
5356               tmp___50 = tmp___46;   5356               tmp___50 = tmp___46;
5357             } else {   5357             } else {
5358               tmp___49 = __builtin_strcmp((char const   *)opt, "g3");   5358               tmp___49 = __builtin_strcmp((char const   *)opt, "g3");
5359               tmp___50 = tmp___49;   5359               tmp___50 = tmp___49;
5360             }   5360             }
5361           } else {   5361           } else {
5362             tmp___49 = __builtin_strcmp((char const   *)opt, "g3");   5362             tmp___49 = __builtin_strcmp((char const   *)opt, "g3");
5363             tmp___50 = tmp___49;   5363             tmp___50 = tmp___49;
5364           }   5364           }
5365           tmp___53 = tmp___50;   5365           tmp___53 = tmp___50;
5366         } else {   5366         } else {
5367           tmp___52 = strncmp((char const   *)opt, "g3", (size_t )2);   5367           tmp___52 = strncmp((char const   *)opt, "g3", (size_t )2);
5368           tmp___53 = tmp___52;   5368           tmp___53 = tmp___52;
5369         }   5369         }
5370         if (tmp___53 == 0) {   5370         if (tmp___53 == 0) {
5371           processG3Options(opt);   5371           processG3Options(opt);
5372           defcompression = (uint16 )3;   5372           defcompression = (uint16 )3;
5373         } else {   5373         } else {
5374           if (0) {   5374           if (0) {
5375             __s1_len___1 = strlen((char const   *)opt);   5375             __s1_len___1 = strlen((char const   *)opt);
5376             __s2_len___1 = strlen("g4");   5376             __s2_len___1 = strlen("g4");
5377             if (! ((size_t )((void const   *)(opt + 1)) - (size_t )((void const   *)opt) == 1U)) {   5377             if (! ((size_t )((void const   *)(opt + 1)) - (size_t )((void const   *)opt) == 1U)) {
5378               goto _L___4;   5378               goto _L___4;
5379             } else   5379             } else
5380             if (__s1_len___1 >= 4U) {   5380             if (__s1_len___1 >= 4U) {
5381               _L___4: /* CIL Label */   5381               _L___4: /* CIL Label */
5382               if (! ((size_t )((void const   *)("g4" + 1)) - (size_t )((void const   *)"g4") == 1U)) {   5382               if (! ((size_t )((void const   *)("g4" + 1)) - (size_t )((void const   *)"g4") == 1U)) {
5383                 tmp___42 = 1;   5383                 tmp___42 = 1;
5384               } else   5384               } else
5385               if (__s2_len___1 >= 4U) {   5385               if (__s2_len___1 >= 4U) {
5386                 tmp___42 = 1;   5386                 tmp___42 = 1;
5387               } else {   5387               } else {
5388                 tmp___42 = 0;   5388                 tmp___42 = 0;
5389               }   5389               }
5390             } else {   5390             } else {
5391               tmp___42 = 0;   5391               tmp___42 = 0;
5392             }   5392             }
5393             if (tmp___42) {   5393             if (tmp___42) {
5394               tmp___37 = __builtin_strcmp((char const   *)opt, "g4");   5394               tmp___37 = __builtin_strcmp((char const   *)opt, "g4");
5395               tmp___41 = tmp___37;   5395               tmp___41 = tmp___37;
5396             } else {   5396             } else {
5397               tmp___40 = __builtin_strcmp((char const   *)opt, "g4");   5397               tmp___40 = __builtin_strcmp((char const   *)opt, "g4");
5398               tmp___41 = tmp___40;   5398               tmp___41 = tmp___40;
5399             }   5399             }
5400           } else {   5400           } else {
5401             tmp___40 = __builtin_strcmp((char const   *)opt, "g4");   5401             tmp___40 = __builtin_strcmp((char const   *)opt, "g4");
5402             tmp___41 = tmp___40;   5402             tmp___41 = tmp___40;
5403           }   5403           }
5404           if (tmp___41 == 0) {   5404           if (tmp___41 == 0) {
5405             defcompression = (uint16 )4;   5405             defcompression = (uint16 )4;
5406           } else {   5406           } else {
5407             if (0) {   5407             if (0) {
5408               if (0) {   5408               if (0) {
5409                 __s1_len___0 = strlen((char const   *)opt);   5409                 __s1_len___0 = strlen((char const   *)opt);
5410                 __s2_len___0 = strlen("lzw");   5410                 __s2_len___0 = strlen("lzw");
5411                 if (! ((size_t )((void const   *)(opt + 1)) - (size_t )((void const   *)opt) == 1U)) {   5411                 if (! ((size_t )((void const   *)(opt + 1)) - (size_t )((void const   *)opt) == 1U)) {
5412                   goto _L___2;   5412                   goto _L___2;
5413                 } else   5413                 } else
5414                 if (__s1_len___0 >= 4U) {   5414                 if (__s1_len___0 >= 4U) {
5415                   _L___2: /* CIL Label */   5415                   _L___2: /* CIL Label */
5416                   if (! ((size_t )((void const   *)("lzw" + 1)) - (size_t )((void const   *)"lzw") == 1U)) {   5416                   if (! ((size_t )((void const   *)("lzw" + 1)) - (size_t )((void const   *)"lzw") == 1U)) {
5417                     tmp___31 = 1;   5417                     tmp___31 = 1;
5418                   } else   5418                   } else
5419                   if (__s2_len___0 >= 4U) {   5419                   if (__s2_len___0 >= 4U) {
5420                     tmp___31 = 1;   5420                     tmp___31 = 1;
5421                   } else {   5421                   } else {
5422                     tmp___31 = 0;   5422                     tmp___31 = 0;
5423                   }   5423                   }
5424                 } else {   5424                 } else {
5425                   tmp___31 = 0;   5425                   tmp___31 = 0;
5426                 }   5426                 }
5427                 if (tmp___31) {   5427                 if (tmp___31) {
5428                   tmp___26 = __builtin_strcmp((char const   *)opt, "lzw");   5428                   tmp___26 = __builtin_strcmp((char const   *)opt, "lzw");
5429                   tmp___30 = tmp___26;   5429                   tmp___30 = tmp___26;
5430                 } else {   5430                 } else {
5431                   tmp___29 = __builtin_strcmp((char const   *)opt, "lzw");   5431                   tmp___29 = __builtin_strcmp((char const   *)opt, "lzw");
5432                   tmp___30 = tmp___29;   5432                   tmp___30 = tmp___29;
5433                 }   5433                 }
5434               } else {   5434               } else {
5435                 tmp___29 = __builtin_strcmp((char const   *)opt, "lzw");   5435                 tmp___29 = __builtin_strcmp((char const   *)opt, "lzw");
5436                 tmp___30 = tmp___29;   5436                 tmp___30 = tmp___29;
5437               }   5437               }
5438               tmp___33 = tmp___30;   5438               tmp___33 = tmp___30;
5439             } else {   5439             } else {
5440               tmp___32 = strncmp((char const   *)opt, "lzw", (size_t )3);   5440               tmp___32 = strncmp((char const   *)opt, "lzw", (size_t )3);
5441               tmp___33 = tmp___32;   5441               tmp___33 = tmp___32;
5442             }   5442             }
5443             if (tmp___33 == 0) {   5443             if (tmp___33 == 0) {
5444               tmp___5 = __builtin_strchr(opt, ':');   5444               tmp___5 = __builtin_strchr(opt, ':');
5445               cp___0 = tmp___5;   5445               cp___0 = tmp___5;
5446               if (cp___0) {   5446               if (cp___0) {
5447                 tmp___6 = atoi((char const   *)(cp___0 + 1));   5447                 tmp___6 = atoi((char const   *)(cp___0 + 1));
5448                 defpredictor = (uint16 )tmp___6;   5448                 defpredictor = (uint16 )tmp___6;
5449               } else {   5449               } else {
5450     5450  
5451               }   5451               }
5452               defcompression = (uint16 )5;   5452               defcompression = (uint16 )5;
5453             } else {   5453             } else {
5454               if (0) {   5454               if (0) {
5455                 if (0) {   5455                 if (0) {
5456                   __s1_len = strlen((char const   *)opt);   5456                   __s1_len = strlen((char const   *)opt);
5457                   __s2_len = strlen("zip");   5457                   __s2_len = strlen("zip");
5458                   if (! ((size_t )((void const   *)(opt + 1)) - (size_t )((void const   *)opt) == 1U)) {   5458                   if (! ((size_t )((void const   *)(opt + 1)) - (size_t )((void const   *)opt) == 1U)) {
5459                     goto _L___0;   5459                     goto _L___0;
5460                   } else   5460                   } else
5461                   if (__s1_len >= 4U) {   5461                   if (__s1_len >= 4U) {
5462                     _L___0: /* CIL Label */   5462                     _L___0: /* CIL Label */
5463                     if (! ((size_t )((void const   *)("zip" + 1)) - (size_t )((void const   *)"zip") == 1U)) {   5463                     if (! ((size_t )((void const   *)("zip" + 1)) - (size_t )((void const   *)"zip") == 1U)) {
5464                       tmp___18 = 1;   5464                       tmp___18 = 1;
5465                     } else   5465                     } else
5466                     if (__s2_len >= 4U) {   5466                     if (__s2_len >= 4U) {
5467                       tmp___18 = 1;   5467                       tmp___18 = 1;
5468                     } else {   5468                     } else {
5469                       tmp___18 = 0;   5469                       tmp___18 = 0;
5470                     }   5470                     }
5471                   } else {   5471                   } else {
5472                     tmp___18 = 0;   5472                     tmp___18 = 0;
5473                   }   5473                   }
5474                   if (tmp___18) {   5474                   if (tmp___18) {
5475                     tmp___13 = __builtin_strcmp((char const   *)opt, "zip");   5475                     tmp___13 = __builtin_strcmp((char const   *)opt, "zip");
5476                     tmp___17 = tmp___13;   5476                     tmp___17 = tmp___13;
5477                   } else {   5477                   } else {
5478                     tmp___16 = __builtin_strcmp((char const   *)opt, "zip");   5478                     tmp___16 = __builtin_strcmp((char const   *)opt, "zip");
5479                     tmp___17 = tmp___16;   5479                     tmp___17 = tmp___16;
5480                   }   5480                   }
5481                 } else {   5481                 } else {
5482                   tmp___16 = __builtin_strcmp((char const   *)opt, "zip");   5482                   tmp___16 = __builtin_strcmp((char const   *)opt, "zip");
5483                   tmp___17 = tmp___16;   5483                   tmp___17 = tmp___16;
5484                 }   5484                 }
5485                 tmp___20 = tmp___17;   5485                 tmp___20 = tmp___17;
5486               } else {   5486               } else {
5487                 tmp___19 = strncmp((char const   *)opt, "zip", (size_t )3);   5487                 tmp___19 = strncmp((char const   *)opt, "zip", (size_t )3);
5488                 tmp___20 = tmp___19;   5488                 tmp___20 = tmp___19;
5489               }   5489               }
5490               if (tmp___20 == 0) {   5490               if (tmp___20 == 0) {
5491                 tmp___8 = __builtin_strchr(opt, ':');   5491                 tmp___8 = __builtin_strchr(opt, ':');
5492                 cp___1 = tmp___8;   5492                 cp___1 = tmp___8;
5493                 if (cp___1) {   5493                 if (cp___1) {
5494                   tmp___9 = atoi((char const   *)(cp___1 + 1));   5494                   tmp___9 = atoi((char const   *)(cp___1 + 1));
5495                   defpredictor = (uint16 )tmp___9;   5495                   defpredictor = (uint16 )tmp___9;
5496                 } else {   5496                 } else {
5497     5497  
5498                 }   5498                 }
5499                 defcompression = (uint16 )8;   5499                 defcompression = (uint16 )8;
5500               } else {   5500               } else {
5501                 return (0);   5501                 return (0);
5502               }   5502               }
5503             }   5503             }
5504           }   5504           }
5505         }   5505         }
5506       }   5506       }
5507     }   5507     }
5508   }   5508   }
5509   return (1);   5509   return (1);
5510 }   5510 }
5511 }   5511 }
5512 static void usage(void)   5512 static void usage(void)
5513 {   5513 {
5514   char buf[8192] ;   5514   char buf[8192] ;
5515   int i ;   5515   int i ;
5516   char const   *tmp ;   5516   char const   *tmp ;
5517     5517  
5518   {   5518   {
5519   setbuf((FILE */* __restrict  */)stderr, (char */* __restrict  */)(buf));   5519   setbuf((FILE */* __restrict  */)stderr, (char */* __restrict  */)(buf));
5520   tmp = TIFFGetVersion();   5520   tmp = TIFFGetVersion();
5521   fprintf((FILE */* __restrict  */)stderr,   5521   fprintf((FILE */* __restrict  */)stderr,
5522           (char const   */* __restrict  */)"\n%s\n", tmp);   5522           (char const   */* __restrict  */)"\n%s\n", tmp);
5523   i = 0;   5523   i = 0;
5524   while ((unsigned int )stuff[i] != (unsigned int )((void *)0)) {   5524   while ((unsigned int )stuff[i] != (unsigned int )((void *)0)) {
5525     fprintf((FILE */* __restrict  */)stderr,   5525     fprintf((FILE */* __restrict  */)stderr,
5526             (char const   */* __restrict  */)"%s\n", stuff[i]);   5526             (char const   */* __restrict  */)"%s\n", stuff[i]);
5527     i ++;   5527     i ++;
5528   }   5528   }
5529   exit(-1);   5529   exit(-1);
5530 }   5530 }
5531 }   5531 }
5532 static void cpTag(TIFF *in , TIFF *out , uint16 tag , uint16 count ,   5532 static void cpTag(TIFF *in , TIFF *out , uint16 tag , uint16 count ,
5533                   TIFFDataType type )   5533                   TIFFDataType type )
5534 {   5534 {
5535   uint16 shortv ;   5535   uint16 shortv ;
5536   int tmp ;   5536   int tmp ;
5537   uint16 shortv1 ;   5537   uint16 shortv1 ;
5538   uint16 shortv2 ;   5538   uint16 shortv2 ;
5539   int tmp___0 ;   5539   int tmp___0 ;
5540   uint16 *tr ;   5540   uint16 *tr ;
5541   uint16 *tg ;   5541   uint16 *tg ;
5542   uint16 *tb ;   5542   uint16 *tb ;
5543   uint16 *ta ;   5543   uint16 *ta ;
5544   int tmp___1 ;   5544   int tmp___1 ;
5545   uint16 shortv1___0 ;   5545   uint16 shortv1___0 ;
5546   uint16 *shortav ;   5546   uint16 *shortav ;
5547   int tmp___2 ;   5547   int tmp___2 ;
5548   uint32 longv ;   5548   uint32 longv ;
5549   int tmp___3 ;   5549   int tmp___3 ;
5550   float floatv ;   5550   float floatv ;
5551   int tmp___4 ;   5551   int tmp___4 ;
5552   float *floatav ;   5552   float *floatav ;
5553   int tmp___5 ;   5553   int tmp___5 ;
5554   char *stringv ;   5554   char *stringv ;
5555   int tmp___6 ;   5555   int tmp___6 ;
5556   double doublev ;   5556   double doublev ;
5557   int tmp___7 ;   5557   int tmp___7 ;
5558   double *doubleav ;   5558   double *doubleav ;
5559   int tmp___8 ;   5559   int tmp___8 ;
5560   char const   *tmp___9 ;   5560   char const   *tmp___9 ;
5561     5561  
5562   {   5562   {
5563   switch ((unsigned int )type) {   5563   switch ((unsigned int )type) {
5564   case 3U:   5564   case 3U:
5565   if ((int )count == 1) {   5565   if ((int )count == 1) {
5566     tmp = TIFFGetField(in, (uint32 )tag, & shortv);   5566     tmp = TIFFGetField(in, (uint32 )tag, & shortv);
5567     if (tmp) {   5567     if (tmp) {
5568       TIFFSetField(out, (uint32 )tag, (int )shortv);   5568       TIFFSetField(out, (uint32 )tag, (int )shortv);
5569     } else {   5569     } else {
5570     5570  
5571     }   5571     }
5572   } else   5572   } else
5573   if ((int )count == 2) {   5573   if ((int )count == 2) {
5574     tmp___0 = TIFFGetField(in, (uint32 )tag, & shortv1, & shortv2);   5574     tmp___0 = TIFFGetField(in, (uint32 )tag, & shortv1, & shortv2);
5575     if (tmp___0) {   5575     if (tmp___0) {
5576       TIFFSetField(out, (uint32 )tag, (int )shortv1, (int )shortv2);   5576       TIFFSetField(out, (uint32 )tag, (int )shortv1, (int )shortv2);
5577     } else {   5577     } else {
5578     5578  
5579     }   5579     }
5580   } else   5580   } else
5581   if ((int )count == 4) {   5581   if ((int )count == 4) {
5582     tmp___1 = TIFFGetField(in, (uint32 )tag, & tr, & tg, & tb, & ta);   5582     tmp___1 = TIFFGetField(in, (uint32 )tag, & tr, & tg, & tb, & ta);
5583     if (tmp___1) {   5583     if (tmp___1) {
5584       TIFFSetField(out, (uint32 )tag, tr, tg, tb, ta);   5584       TIFFSetField(out, (uint32 )tag, tr, tg, tb, ta);
5585     } else {   5585     } else {
5586     5586  
5587     }   5587     }
5588   } else   5588   } else
5589   if ((int )count == 65535) {   5589   if ((int )count == 65535) {
5590     tmp___2 = TIFFGetField(in, (uint32 )tag, & shortv1___0, & shortav);   5590     tmp___2 = TIFFGetField(in, (uint32 )tag, & shortv1___0, & shortav);
5591     if (tmp___2) {   5591     if (tmp___2) {
5592       TIFFSetField(out, (uint32 )tag, (int )shortv1___0, shortav);   5592       TIFFSetField(out, (uint32 )tag, (int )shortv1___0, shortav);
5593     } else {   5593     } else {
5594     5594  
5595     }   5595     }
5596   } else {   5596   } else {
5597     5597  
5598   }   5598   }
5599   break;   5599   break;
5600   case 4U:   5600   case 4U:
5601   tmp___3 = TIFFGetField(in, (uint32 )tag, & longv);   5601   tmp___3 = TIFFGetField(in, (uint32 )tag, & longv);
5602   if (tmp___3) {   5602   if (tmp___3) {
5603     TIFFSetField(out, (uint32 )tag, longv);   5603     TIFFSetField(out, (uint32 )tag, longv);
5604   } else {   5604   } else {
5605     5605  
5606   }   5606   }
5607   break;   5607   break;
5608   case 5U:   5608   case 5U:
5609   if ((int )count == 1) {   5609   if ((int )count == 1) {
5610     tmp___4 = TIFFGetField(in, (uint32 )tag, & floatv);   5610     tmp___4 = TIFFGetField(in, (uint32 )tag, & floatv);
5611     if (tmp___4) {   5611     if (tmp___4) {
5612       TIFFSetField(out, (uint32 )tag, (double )floatv);   5612       TIFFSetField(out, (uint32 )tag, (double )floatv);
5613     } else {   5613     } else {
5614     5614  
5615     }   5615     }
5616   } else   5616   } else
5617   if ((int )count == 65535) {   5617   if ((int )count == 65535) {
5618     tmp___5 = TIFFGetField(in, (uint32 )tag, & floatav);   5618     tmp___5 = TIFFGetField(in, (uint32 )tag, & floatav);
5619     if (tmp___5) {   5619     if (tmp___5) {
5620       TIFFSetField(out, (uint32 )tag, floatav);   5620       TIFFSetField(out, (uint32 )tag, floatav);
5621     } else {   5621     } else {
5622     5622  
5623     }   5623     }
5624   } else {   5624   } else {
5625     5625  
5626   }   5626   }
5627   break;   5627   break;
5628   case 2U:   5628   case 2U:
5629   tmp___6 = TIFFGetField(in, (uint32 )tag, & stringv);   5629   tmp___6 = TIFFGetField(in, (uint32 )tag, & stringv);
5630   if (tmp___6) {   5630   if (tmp___6) {
5631     TIFFSetField(out, (uint32 )tag, stringv);   5631     TIFFSetField(out, (uint32 )tag, stringv);
5632   } else {   5632   } else {
5633     5633  
5634   }   5634   }
5635   break;   5635   break;
5636   case 12U:   5636   case 12U:
5637   if ((int )count == 1) {   5637   if ((int )count == 1) {
5638     tmp___7 = TIFFGetField(in, (uint32 )tag, & doublev);   5638     tmp___7 = TIFFGetField(in, (uint32 )tag, & doublev);
5639     if (tmp___7) {   5639     if (tmp___7) {
5640       TIFFSetField(out, (uint32 )tag, doublev);   5640       TIFFSetField(out, (uint32 )tag, doublev);
5641     } else {   5641     } else {
5642     5642  
5643     }   5643     }
5644   } else   5644   } else
5645   if ((int )count == 65535) {   5645   if ((int )count == 65535) {
5646     tmp___8 = TIFFGetField(in, (uint32 )tag, & doubleav);   5646     tmp___8 = TIFFGetField(in, (uint32 )tag, & doubleav);
5647     if (tmp___8) {   5647     if (tmp___8) {
5648       TIFFSetField(out, (uint32 )tag, doubleav);   5648       TIFFSetField(out, (uint32 )tag, doubleav);
5649     } else {   5649     } else {
5650     5650  
5651     }   5651     }
5652   } else {   5652   } else {
5653     5653  
5654   }   5654   }
5655   break;   5655   break;
5656   default:   5656   default:
5657   tmp___9 = TIFFFileName(in);   5657   tmp___9 = TIFFFileName(in);
5658   TIFFError(tmp___9, "Data type %d is not supported, tag %d skipped.",   5658   TIFFError(tmp___9, "Data type %d is not supported, tag %d skipped.",
5659             (int )tag, (unsigned int )type);   5659             (int )tag, (unsigned int )type);
5660   }   5660   }
5661   return;   5661   return;
5662 }   5662 }
5663 }   5663 }
5664 static struct cpTag tags[33]  =   5664 static struct cpTag tags[33]  =
5665   {      {(uint16 )254, (uint16 )1, (TIFFDataType )4},   5665   {      {(uint16 )254, (uint16 )1, (TIFFDataType )4},
5666         {(uint16 )263, (uint16 )1, (TIFFDataType )3},   5666         {(uint16 )263, (uint16 )1, (TIFFDataType )3},
5667         {(uint16 )269, (uint16 )1, (TIFFDataType )2},   5667         {(uint16 )269, (uint16 )1, (TIFFDataType )2},
5668         {(uint16 )270, (uint16 )1, (TIFFDataType )2},   5668         {(uint16 )270, (uint16 )1, (TIFFDataType )2},
5669         {(uint16 )271, (uint16 )1, (TIFFDataType )2},   5669         {(uint16 )271, (uint16 )1, (TIFFDataType )2},
5670         {(uint16 )272, (uint16 )1, (TIFFDataType )2},   5670         {(uint16 )272, (uint16 )1, (TIFFDataType )2},
5671         {(uint16 )280, (uint16 )1, (TIFFDataType )3},   5671         {(uint16 )280, (uint16 )1, (TIFFDataType )3},
5672         {(uint16 )281, (uint16 )1, (TIFFDataType )3},   5672         {(uint16 )281, (uint16 )1, (TIFFDataType )3},
5673         {(uint16 )282, (uint16 )1, (TIFFDataType )5},   5673         {(uint16 )282, (uint16 )1, (TIFFDataType )5},
5674         {(uint16 )283, (uint16 )1, (TIFFDataType )5},   5674         {(uint16 )283, (uint16 )1, (TIFFDataType )5},
5675         {(uint16 )285, (uint16 )1, (TIFFDataType )2},   5675         {(uint16 )285, (uint16 )1, (TIFFDataType )2},
5676         {(uint16 )286, (uint16 )1, (TIFFDataType )5},   5676         {(uint16 )286, (uint16 )1, (TIFFDataType )5},
5677         {(uint16 )287, (uint16 )1, (TIFFDataType )5},   5677         {(uint16 )287, (uint16 )1, (TIFFDataType )5},
5678         {(uint16 )296, (uint16 )1, (TIFFDataType )3},   5678         {(uint16 )296, (uint16 )1, (TIFFDataType )3},
5679         {(uint16 )305, (uint16 )1, (TIFFDataType )2},   5679         {(uint16 )305, (uint16 )1, (TIFFDataType )2},
5680         {(uint16 )306, (uint16 )1, (TIFFDataType )2},   5680         {(uint16 )306, (uint16 )1, (TIFFDataType )2},
5681         {(uint16 )315, (uint16 )1, (TIFFDataType )2},   5681         {(uint16 )315, (uint16 )1, (TIFFDataType )2},
5682         {(uint16 )316, (uint16 )1, (TIFFDataType )2},   5682         {(uint16 )316, (uint16 )1, (TIFFDataType )2},
5683         {(uint16 )318, (uint16 )-1, (TIFFDataType )5},   5683         {(uint16 )318, (uint16 )-1, (TIFFDataType )5},
5684         {(uint16 )319, (uint16 )-1, (TIFFDataType )5},   5684         {(uint16 )319, (uint16 )-1, (TIFFDataType )5},
5685         {(uint16 )321, (uint16 )2, (TIFFDataType )3},   5685         {(uint16 )321, (uint16 )2, (TIFFDataType )3},
5686         {(uint16 )332, (uint16 )1, (TIFFDataType )3},   5686         {(uint16 )332, (uint16 )1, (TIFFDataType )3},
5687         {(uint16 )336, (uint16 )2, (TIFFDataType )3},   5687         {(uint16 )336, (uint16 )2, (TIFFDataType )3},
5688         {(uint16 )337, (uint16 )1, (TIFFDataType )2},   5688         {(uint16 )337, (uint16 )1, (TIFFDataType )2},
5689         {(uint16 )339, (uint16 )1, (TIFFDataType )3},   5689         {(uint16 )339, (uint16 )1, (TIFFDataType )3},
5690         {(uint16 )529, (uint16 )-1, (TIFFDataType )5},   5690         {(uint16 )529, (uint16 )-1, (TIFFDataType )5},
5691         {(uint16 )530, (uint16 )2, (TIFFDataType )3},   5691         {(uint16 )530, (uint16 )2, (TIFFDataType )3},
5692         {(uint16 )531, (uint16 )1, (TIFFDataType )3},   5692         {(uint16 )531, (uint16 )1, (TIFFDataType )3},
5693         {(uint16 )532, (uint16 )-1, (TIFFDataType )5},   5693         {(uint16 )532, (uint16 )-1, (TIFFDataType )5},
5694         {(uint16 )338, (uint16 )-1, (TIFFDataType )3},   5694         {(uint16 )338, (uint16 )-1, (TIFFDataType )3},
5695         {(uint16 )340, (uint16 )1, (TIFFDataType )12},   5695         {(uint16 )340, (uint16 )1, (TIFFDataType )12},
5696         {(uint16 )341, (uint16 )1, (TIFFDataType )12},   5696         {(uint16 )341, (uint16 )1, (TIFFDataType )12},
5697         {(uint16 )37439, (uint16 )1, (TIFFDataType )12}};   5697         {(uint16 )37439, (uint16 )1, (TIFFDataType )12}};
5698 static void cpStripToTile(uint8 *out , uint8 *in , uint32 rows , uint32 cols ,   5698 static void cpStripToTile(uint8 *out , uint8 *in , uint32 rows , uint32 cols ,
5699                           int outskew , int inskew )   5699                           int outskew , int inskew )
5700 {   5700 {
5701   uint32 j ;   5701   uint32 j ;
5702   uint8 *tmp ;   5702   uint8 *tmp ;
5703   uint8 *tmp___0 ;   5703   uint8 *tmp___0 ;
5704   uint32 tmp___1 ;   5704   uint32 tmp___1 ;
5705   uint32 tmp___2 ;   5705   uint32 tmp___2 ;
5706     5706  
5707   {   5707   {
5708   while (1) {   5708   while (1) {
5709     tmp___2 = rows;   5709     tmp___2 = rows;
5710     rows --;   5710     rows --;
5711     if (tmp___2 > 0U) {   5711     if (tmp___2 > 0U) {
5712     5712  
5713     } else {   5713     } else {
5714       break;   5714       break;
5715     }   5715     }
5716     j = cols;   5716     j = cols;
5717     while (1) {   5717     while (1) {
5718       tmp___1 = j;   5718       tmp___1 = j;
5719       j --;   5719       j --;
5720       if (tmp___1 > 0U) {   5720       if (tmp___1 > 0U) {
5721     5721  
5722       } else {   5722       } else {
5723         break;   5723         break;
5724       }   5724       }
5725       tmp = out;   5725       tmp = out;
5726       out ++;   5726       out ++;
5727       tmp___0 = in;   5727       tmp___0 = in;
5728       in ++;   5728       in ++;
5729       *tmp = *tmp___0;   5729       *tmp = *tmp___0;
5730     }   5730     }
5731     out += outskew;   5731     out += outskew;
5732     in += inskew;   5732     in += inskew;
5733   }   5733   }
5734   return;   5734   return;
5735 }   5735 }
5736 }   5736 }
5737 void process_command_opts(int argc , char **argv , char *mp , char *mode ,   5737 void process_command_opts(int argc , char **argv , char *mp , char *mode ,
5738                           uint32 *dirnum , uint16 *defconfig ,   5738                           uint32 *dirnum , uint16 *defconfig ,
5739                           uint16 *deffillorder , uint32 *deftilewidth ,   5739                           uint16 *deffillorder , uint32 *deftilewidth ,
5740                           uint32 *deftilelength , uint32 *defrowsperstrip ,   5740                           uint32 *deftilelength , uint32 *defrowsperstrip ,
5741                           struct crop_mask *crop_data , struct pagedef *page ,   5741                           struct crop_mask *crop_data , struct pagedef *page ,
5742                           struct dump_opts *dump , unsigned int *imagelist ,   5742                           struct dump_opts *dump , unsigned int *imagelist ,
5743                           unsigned int *image_count )   5743                           unsigned int *image_count )
5744 {   5744 {
5745   int c ;   5745   int c ;
5746   int good_args ;   5746   int good_args ;
5747   char *opt_offset ;   5747   char *opt_offset ;
5748   char *opt_ptr ;   5748   char *opt_ptr ;
5749   char *sep ;   5749   char *sep ;
5750   unsigned int i ;   5750   unsigned int i ;
5751   unsigned int j ;   5751   unsigned int j ;
5752   unsigned int start ;   5752   unsigned int start ;
5753   unsigned int end ;   5753   unsigned int end ;
5754   char *tmp ;   5754   char *tmp ;
5755   int tmp___0 ;   5755   int tmp___0 ;
5756   unsigned long tmp___1 ;   5756   unsigned long tmp___1 ;
5757   int __res ;   5757   int __res ;
5758   int __c ;   5758   int __c ;
5759   __int32_t const   **tmp___2 ;   5759   __int32_t const   **tmp___2 ;
5760   __int32_t const   **tmp___3 ;   5760   __int32_t const   **tmp___3 ;
5761   size_t __s1_len ;   5761   size_t __s1_len ;
5762   size_t __s2_len ;   5762   size_t __s2_len ;
5763   int tmp___4 ;   5763   int tmp___4 ;
5764   int tmp___5 ;   5764   int tmp___5 ;
5765   int tmp___6 ;   5765   int tmp___6 ;
5766   unsigned char const   *__s2 ;   5766   unsigned char const   *__s2 ;
5767   register int __result ;   5767   register int __result ;
5768   int tmp___7 ;   5768   int tmp___7 ;
5769   unsigned char const   *__s1 ;   5769   unsigned char const   *__s1 ;
5770   register int __result___0 ;   5770   register int __result___0 ;
5771   int tmp___8 ;   5771   int tmp___8 ;
5772   int tmp___9 ;   5772   int tmp___9 ;
5773   int tmp___10 ;   5773   int tmp___10 ;
5774   size_t __s1_len___0 ;   5774   size_t __s1_len___0 ;
5775   size_t __s2_len___0 ;   5775   size_t __s2_len___0 ;
5776   int tmp___11 ;   5776   int tmp___11 ;
5777   int tmp___12 ;   5777   int tmp___12 ;
5778   int tmp___13 ;   5778   int tmp___13 ;
5779   unsigned char const   *__s2___0 ;   5779   unsigned char const   *__s2___0 ;
5780   register int __result___1 ;   5780   register int __result___1 ;
5781   int tmp___14 ;   5781   int tmp___14 ;
5782   unsigned char const   *__s1___0 ;   5782   unsigned char const   *__s1___0 ;
5783   register int __result___2 ;   5783   register int __result___2 ;
5784   int tmp___15 ;   5784   int tmp___15 ;
5785   int tmp___16 ;   5785   int tmp___16 ;
5786   int tmp___17 ;   5786   int tmp___17 ;
5787   int tmp___18 ;   5787   int tmp___18 ;
5788   size_t __s1_len___1 ;   5788   size_t __s1_len___1 ;
5789   size_t __s2_len___1 ;   5789   size_t __s2_len___1 ;
5790   int tmp___19 ;   5790   int tmp___19 ;
5791   int tmp___20 ;   5791   int tmp___20 ;
5792   int tmp___21 ;   5792   int tmp___21 ;
5793   unsigned char const   *__s2___1 ;   5793   unsigned char const   *__s2___1 ;
5794   register int __result___3 ;   5794   register int __result___3 ;
5795   int tmp___22 ;   5795   int tmp___22 ;
5796   unsigned char const   *__s1___1 ;   5796   unsigned char const   *__s1___1 ;
5797   register int __result___4 ;   5797   register int __result___4 ;
5798   int tmp___23 ;   5798   int tmp___23 ;
5799   int tmp___24 ;   5799   int tmp___24 ;
5800   int tmp___25 ;   5800   int tmp___25 ;
5801   size_t __s1_len___2 ;   5801   size_t __s1_len___2 ;
5802   size_t __s2_len___2 ;   5802   size_t __s2_len___2 ;
5803   int tmp___26 ;   5803   int tmp___26 ;
5804   int tmp___27 ;   5804   int tmp___27 ;
5805   int tmp___28 ;   5805   int tmp___28 ;
5806   unsigned char const   *__s2___2 ;   5806   unsigned char const   *__s2___2 ;
5807   register int __result___5 ;   5807   register int __result___5 ;
5808   int tmp___29 ;   5808   int tmp___29 ;
5809   unsigned char const   *__s1___2 ;   5809   unsigned char const   *__s1___2 ;
5810   register int __result___6 ;   5810   register int __result___6 ;
5811   int tmp___30 ;   5811   int tmp___30 ;
5812   int tmp___31 ;   5812   int tmp___31 ;
5813   int tmp___32 ;   5813   int tmp___32 ;
5814   long tmp___33 ;   5814   long tmp___33 ;
5815   int tmp___34 ;   5815   int tmp___34 ;
5816   int tmp___35 ;   5816   int tmp___35 ;
5817   char *tmp___36 ;   5817   char *tmp___36 ;
5818   char *tmp___37 ;   5818   char *tmp___37 ;
5819   char *tmp___38 ;   5819   char *tmp___38 ;
5820   char *tmp___39 ;   5820   char *tmp___39 ;
5821   char __a0 ;   5821   char __a0 ;
5822   char __a1 ;   5822   char __a1 ;
5823   char __a2 ;   5823   char __a2 ;
5824   char *tmp___40 ;   5824   char *tmp___40 ;
5825   char *tmp___41 ;   5825   char *tmp___41 ;
5826   char *tmp___42 ;   5826   char *tmp___42 ;
5827   char *tmp___43 ;   5827   char *tmp___43 ;
5828   char *tmp___44 ;   5828   char *tmp___44 ;
5829   char *tmp___45 ;   5829   char *tmp___45 ;
5830   char *tmp___46 ;   5830   char *tmp___46 ;
5831   char *tmp___47 ;   5831   char *tmp___47 ;
5832   char *tmp___48 ;   5832   char *tmp___48 ;
5833   char *tmp___49 ;   5833   char *tmp___49 ;
5834   int __res___0 ;   5834   int __res___0 ;
5835   int __c___0 ;   5835   int __c___0 ;
5836   __int32_t const   **tmp___50 ;   5836   __int32_t const   **tmp___50 ;
5837   __int32_t const   **tmp___51 ;   5837   __int32_t const   **tmp___51 ;
5838   int __res___1 ;   5838   int __res___1 ;
5839   int __c___1 ;   5839   int __c___1 ;
5840   __int32_t const   **tmp___52 ;   5840   __int32_t const   **tmp___52 ;
5841   __int32_t const   **tmp___53 ;   5841   __int32_t const   **tmp___53 ;
5842   size_t tmp___54 ;   5842   size_t tmp___54 ;
5843   size_t tmp___55 ;   5843   size_t tmp___55 ;
5844   size_t __s1_len___3 ;   5844   size_t __s1_len___3 ;
5845   size_t __s2_len___3 ;   5845   size_t __s2_len___3 ;
5846   int tmp___56 ;   5846   int tmp___56 ;
5847   int tmp___57 ;   5847   int tmp___57 ;
5848   int tmp___58 ;   5848   int tmp___58 ;
5849   unsigned char const   *__s2___3 ;   5849   unsigned char const   *__s2___3 ;
5850   register int __result___7 ;   5850   register int __result___7 ;
5851   int tmp___59 ;   5851   int tmp___59 ;
5852   unsigned char const   *__s1___3 ;   5852   unsigned char const   *__s1___3 ;
5853   register int __result___8 ;   5853   register int __result___8 ;
5854   int tmp___60 ;   5854   int tmp___60 ;
5855   int tmp___61 ;   5855   int tmp___61 ;
5856   int tmp___62 ;   5856   int tmp___62 ;
5857   int tmp___63 ;   5857   int tmp___63 ;
5858   int tmp___64 ;   5858   int tmp___64 ;
5859   size_t tmp___65 ;   5859   size_t tmp___65 ;
5860   size_t tmp___66 ;   5860   size_t tmp___66 ;
5861   size_t tmp___67 ;   5861   size_t tmp___67 ;
5862   size_t tmp___68 ;   5862   size_t tmp___68 ;
5863   size_t __s1_len___4 ;   5863   size_t __s1_len___4 ;
5864   size_t __s2_len___4 ;   5864   size_t __s2_len___4 ;
5865   int tmp___69 ;   5865   int tmp___69 ;
5866   int tmp___70 ;   5866   int tmp___70 ;
5867   int tmp___71 ;   5867   int tmp___71 ;
5868   unsigned char const   *__s2___4 ;   5868   unsigned char const   *__s2___4 ;
5869   register int __result___9 ;   5869   register int __result___9 ;
5870   int tmp___72 ;   5870   int tmp___72 ;
5871   unsigned char const   *__s1___4 ;   5871   unsigned char const   *__s1___4 ;
5872   register int __result___10 ;   5872   register int __result___10 ;
5873   int tmp___73 ;   5873   int tmp___73 ;
5874   int tmp___74 ;   5874   int tmp___74 ;
5875   int tmp___75 ;   5875   int tmp___75 ;
5876   int tmp___76 ;   5876   int tmp___76 ;
5877   int tmp___77 ;   5877   int tmp___77 ;
5878   size_t tmp___78 ;   5878   size_t tmp___78 ;
5879   size_t tmp___79 ;   5879   size_t tmp___79 ;
5880   size_t tmp___80 ;   5880   size_t tmp___80 ;
5881   size_t tmp___81 ;   5881   size_t tmp___81 ;
5882   size_t __s1_len___5 ;   5882   size_t __s1_len___5 ;
5883   size_t __s2_len___5 ;   5883   size_t __s2_len___5 ;
5884   int tmp___82 ;   5884   int tmp___82 ;
5885   int tmp___83 ;   5885   int tmp___83 ;
5886   int tmp___84 ;   5886   int tmp___84 ;
5887   unsigned char const   *__s2___5 ;   5887   unsigned char const   *__s2___5 ;
5888   register int __result___11 ;   5888   register int __result___11 ;
5889   int tmp___85 ;   5889   int tmp___85 ;
5890   unsigned char const   *__s1___5 ;   5890   unsigned char const   *__s1___5 ;
5891   register int __result___12 ;   5891   register int __result___12 ;
5892   int tmp___86 ;   5892   int tmp___86 ;
5893   int tmp___87 ;   5893   int tmp___87 ;
5894   int tmp___88 ;   5894   int tmp___88 ;
5895   int tmp___89 ;   5895   int tmp___89 ;
5896   int tmp___90 ;   5896   int tmp___90 ;
5897   size_t tmp___91 ;   5897   size_t tmp___91 ;
5898   size_t tmp___92 ;   5898   size_t tmp___92 ;
5899   size_t tmp___93 ;   5899   size_t tmp___93 ;
5900   size_t tmp___94 ;   5900   size_t tmp___94 ;
5901   size_t __s1_len___6 ;   5901   size_t __s1_len___6 ;
5902   size_t __s2_len___6 ;   5902   size_t __s2_len___6 ;
5903   int tmp___95 ;   5903   int tmp___95 ;
5904   int tmp___96 ;   5904   int tmp___96 ;
5905   int tmp___97 ;   5905   int tmp___97 ;
5906   unsigned char const   *__s2___6 ;   5906   unsigned char const   *__s2___6 ;
5907   register int __result___13 ;   5907   register int __result___13 ;
5908   int tmp___98 ;   5908   int tmp___98 ;
5909   unsigned char const   *__s1___6 ;   5909   unsigned char const   *__s1___6 ;
5910   register int __result___14 ;   5910   register int __result___14 ;
5911   int tmp___99 ;   5911   int tmp___99 ;
5912   int tmp___100 ;   5912   int tmp___100 ;
5913   int tmp___101 ;   5913   int tmp___101 ;
5914   int tmp___102 ;   5914   int tmp___102 ;
5915   int tmp___103 ;   5915   int tmp___103 ;
5916   size_t tmp___104 ;   5916   size_t tmp___104 ;
5917   size_t tmp___105 ;   5917   size_t tmp___105 ;
5918   size_t tmp___106 ;   5918   size_t tmp___106 ;
5919   size_t tmp___107 ;   5919   size_t tmp___107 ;
5920   size_t __s1_len___7 ;   5920   size_t __s1_len___7 ;
5921   size_t __s2_len___7 ;   5921   size_t __s2_len___7 ;
5922   int tmp___108 ;   5922   int tmp___108 ;
5923   int tmp___109 ;   5923   int tmp___109 ;
5924   int tmp___110 ;   5924   int tmp___110 ;
5925   unsigned char const   *__s2___7 ;   5925   unsigned char const   *__s2___7 ;
5926   register int __result___15 ;   5926   register int __result___15 ;
5927   int tmp___111 ;   5927   int tmp___111 ;
5928   unsigned char const   *__s1___7 ;   5928   unsigned char const   *__s1___7 ;
5929   register int __result___16 ;   5929   register int __result___16 ;
5930   int tmp___112 ;   5930   int tmp___112 ;
5931   int tmp___113 ;   5931   int tmp___113 ;
5932   int tmp___114 ;   5932   int tmp___114 ;
5933   int tmp___115 ;   5933   int tmp___115 ;
5934   int tmp___116 ;   5934   int tmp___116 ;
5935   size_t tmp___117 ;   5935   size_t tmp___117 ;
5936   size_t tmp___118 ;   5936   size_t tmp___118 ;
5937   size_t tmp___119 ;   5937   size_t tmp___119 ;
5938   size_t tmp___120 ;   5938   size_t tmp___120 ;
5939   size_t __s1_len___8 ;   5939   size_t __s1_len___8 ;
5940   size_t __s2_len___8 ;   5940   size_t __s2_len___8 ;
5941   int tmp___121 ;   5941   int tmp___121 ;
5942   int tmp___122 ;   5942   int tmp___122 ;
5943   int tmp___123 ;   5943   int tmp___123 ;
5944   unsigned char const   *__s2___8 ;   5944   unsigned char const   *__s2___8 ;
5945   register int __result___17 ;   5945   register int __result___17 ;
5946   int tmp___124 ;   5946   int tmp___124 ;
5947   unsigned char const   *__s1___8 ;   5947   unsigned char const   *__s1___8 ;
5948   register int __result___18 ;   5948   register int __result___18 ;
5949   int tmp___125 ;   5949   int tmp___125 ;
5950   int tmp___126 ;   5950   int tmp___126 ;
5951   int tmp___127 ;   5951   int tmp___127 ;
5952   int tmp___128 ;   5952   int tmp___128 ;
5953   int tmp___129 ;   5953   int tmp___129 ;
5954   size_t tmp___130 ;   5954   size_t tmp___130 ;
5955   size_t tmp___131 ;   5955   size_t tmp___131 ;
5956   size_t tmp___132 ;   5956   size_t tmp___132 ;
5957   size_t tmp___133 ;   5957   size_t tmp___133 ;
5958   size_t __s1_len___9 ;   5958   size_t __s1_len___9 ;
5959   size_t __s2_len___9 ;   5959   size_t __s2_len___9 ;
5960   int tmp___134 ;   5960   int tmp___134 ;
5961   int tmp___135 ;   5961   int tmp___135 ;
5962   int tmp___136 ;   5962   int tmp___136 ;
5963   unsigned char const   *__s2___9 ;   5963   unsigned char const   *__s2___9 ;
5964   register int __result___19 ;   5964   register int __result___19 ;
5965   int tmp___137 ;   5965   int tmp___137 ;
5966   unsigned char const   *__s1___9 ;   5966   unsigned char const   *__s1___9 ;
5967   register int __result___20 ;   5967   register int __result___20 ;
5968   int tmp___138 ;   5968   int tmp___138 ;
5969   int tmp___139 ;   5969   int tmp___139 ;
5970   int tmp___140 ;   5970   int tmp___140 ;
5971   int tmp___141 ;   5971   int tmp___141 ;
5972   int tmp___142 ;   5972   int tmp___142 ;
5973   size_t tmp___143 ;   5973   size_t tmp___143 ;
5974   size_t tmp___144 ;   5974   size_t tmp___144 ;
5975   size_t tmp___145 ;   5975   size_t tmp___145 ;
5976   size_t tmp___146 ;   5976   size_t tmp___146 ;
5977   int __res___2 ;   5977   int __res___2 ;
5978   int __c___2 ;   5978   int __c___2 ;
5979   __int32_t const   **tmp___147 ;   5979   __int32_t const   **tmp___147 ;
5980   __int32_t const   **tmp___148 ;   5980   __int32_t const   **tmp___148 ;
5981   int __res___3 ;   5981   int __res___3 ;
5982   int __c___3 ;   5982   int __c___3 ;
5983   __int32_t const   **tmp___149 ;   5983   __int32_t const   **tmp___149 ;
5984   __int32_t const   **tmp___150 ;   5984   __int32_t const   **tmp___150 ;
5985   size_t __s1_len___10 ;   5985   size_t __s1_len___10 ;
5986   size_t __s2_len___10 ;   5986   size_t __s2_len___10 ;
5987   int tmp___151 ;   5987   int tmp___151 ;
5988   int tmp___152 ;   5988   int tmp___152 ;
5989   int tmp___153 ;   5989   int tmp___153 ;
5990   unsigned char const   *__s2___10 ;   5990   unsigned char const   *__s2___10 ;
5991   register int __result___21 ;   5991   register int __result___21 ;
5992   int tmp___154 ;   5992   int tmp___154 ;
5993   unsigned char const   *__s1___10 ;   5993   unsigned char const   *__s1___10 ;
5994   register int __result___22 ;   5994   register int __result___22 ;
5995   int tmp___155 ;   5995   int tmp___155 ;
5996   int tmp___156 ;   5996   int tmp___156 ;
5997   int tmp___157 ;   5997   int tmp___157 ;
5998   size_t __s1_len___11 ;   5998   size_t __s1_len___11 ;
5999   size_t __s2_len___11 ;   5999   size_t __s2_len___11 ;
6000   int tmp___158 ;   6000   int tmp___158 ;
6001   int tmp___159 ;   6001   int tmp___159 ;
6002   int tmp___160 ;   6002   int tmp___160 ;
6003   unsigned char const   *__s2___11 ;   6003   unsigned char const   *__s2___11 ;
6004   register int __result___23 ;   6004   register int __result___23 ;
6005   int tmp___161 ;   6005   int tmp___161 ;
6006   unsigned char const   *__s1___11 ;   6006   unsigned char const   *__s1___11 ;
6007   register int __result___24 ;   6007   register int __result___24 ;
6008   int tmp___162 ;   6008   int tmp___162 ;
6009   int tmp___163 ;   6009   int tmp___163 ;
6010   int tmp___164 ;   6010   int tmp___164 ;
6011   size_t __s1_len___12 ;   6011   size_t __s1_len___12 ;
6012   size_t __s2_len___12 ;   6012   size_t __s2_len___12 ;
6013   int tmp___165 ;   6013   int tmp___165 ;
6014   int tmp___166 ;   6014   int tmp___166 ;
6015   int tmp___167 ;   6015   int tmp___167 ;
6016   unsigned char const   *__s2___12 ;   6016   unsigned char const   *__s2___12 ;
6017   register int __result___25 ;   6017   register int __result___25 ;
6018   int tmp___168 ;   6018   int tmp___168 ;
6019   unsigned char const   *__s1___12 ;   6019   unsigned char const   *__s1___12 ;
6020   register int __result___26 ;   6020   register int __result___26 ;
6021   int tmp___169 ;   6021   int tmp___169 ;
6022   int tmp___170 ;   6022   int tmp___170 ;
6023   int tmp___171 ;   6023   int tmp___171 ;
6024   size_t __s1_len___13 ;   6024   size_t __s1_len___13 ;
6025   size_t __s2_len___13 ;   6025   size_t __s2_len___13 ;
6026   int tmp___172 ;   6026   int tmp___172 ;
6027   int tmp___173 ;   6027   int tmp___173 ;
6028   int tmp___174 ;   6028   int tmp___174 ;
6029   unsigned char const   *__s2___13 ;   6029   unsigned char const   *__s2___13 ;
6030   register int __result___27 ;   6030   register int __result___27 ;
6031   int tmp___175 ;   6031   int tmp___175 ;
6032   unsigned char const   *__s1___13 ;   6032   unsigned char const   *__s1___13 ;
6033   register int __result___28 ;   6033   register int __result___28 ;
6034   int tmp___176 ;   6034   int tmp___176 ;
6035   int tmp___177 ;   6035   int tmp___177 ;
6036   int tmp___178 ;   6036   int tmp___178 ;
6037   unsigned int tmp___179 ;   6037   unsigned int tmp___179 ;
6038   unsigned int tmp___180 ;   6038   unsigned int tmp___180 ;
6039   unsigned int tmp___181 ;   6039   unsigned int tmp___181 ;
6040   char __a0___0 ;   6040   char __a0___0 ;
6041   char __a1___0 ;   6041   char __a1___0 ;
6042   char __a2___0 ;   6042   char __a2___0 ;
6043   char *tmp___182 ;   6043   char *tmp___182 ;
6044   char *tmp___183 ;   6044   char *tmp___183 ;
6045   char *tmp___184 ;   6045   char *tmp___184 ;
6046   char *tmp___185 ;   6046   char *tmp___185 ;
6047   char *tmp___186 ;   6047   char *tmp___186 ;
6048   char *tmp___187 ;   6048   char *tmp___187 ;
6049   char *tmp___188 ;   6049   char *tmp___188 ;
6050   char *tmp___189 ;   6050   char *tmp___189 ;
6051   char *tmp___190 ;   6051   char *tmp___190 ;
6052   char *tmp___191 ;   6052   char *tmp___191 ;
6053   unsigned int tmp___192 ;   6053   unsigned int tmp___192 ;
6054   int tmp___193 ;   6054   int tmp___193 ;
6055   int tmp___194 ;   6055   int tmp___194 ;
6056   int tmp___195 ;   6056   int tmp___195 ;
6057   size_t __s1_len___14 ;   6057   size_t __s1_len___14 ;
6058   size_t __s2_len___14 ;   6058   size_t __s2_len___14 ;
6059   int tmp___196 ;   6059   int tmp___196 ;
6060   int tmp___197 ;   6060   int tmp___197 ;
6061   int tmp___198 ;   6061   int tmp___198 ;
6062   unsigned char const   *__s2___14 ;   6062   unsigned char const   *__s2___14 ;
6063   register int __result___29 ;   6063   register int __result___29 ;
6064   int tmp___199 ;   6064   int tmp___199 ;
6065   unsigned char const   *__s1___14 ;   6065   unsigned char const   *__s1___14 ;
6066   register int __result___30 ;   6066   register int __result___30 ;
6067   int tmp___200 ;   6067   int tmp___200 ;
6068   int tmp___201 ;   6068   int tmp___201 ;
6069   int tmp___202 ;   6069   int tmp___202 ;
6070   unsigned int tmp___203 ;   6070   unsigned int tmp___203 ;
6071   size_t __s1_len___15 ;   6071   size_t __s1_len___15 ;
6072   size_t __s2_len___15 ;   6072   size_t __s2_len___15 ;
6073   int tmp___204 ;   6073   int tmp___204 ;
6074   int tmp___205 ;   6074   int tmp___205 ;
6075   int tmp___206 ;   6075   int tmp___206 ;
6076   unsigned char const   *__s2___15 ;   6076   unsigned char const   *__s2___15 ;
6077   register int __result___31 ;   6077   register int __result___31 ;
6078   int tmp___207 ;   6078   int tmp___207 ;
6079   unsigned char const   *__s1___15 ;   6079   unsigned char const   *__s1___15 ;
6080   register int __result___32 ;   6080   register int __result___32 ;
6081   int tmp___208 ;   6081   int tmp___208 ;
6082   int tmp___209 ;   6082   int tmp___209 ;
6083   int tmp___210 ;   6083   int tmp___210 ;
6084   size_t __s1_len___16 ;   6084   size_t __s1_len___16 ;
6085   size_t __s2_len___16 ;   6085   size_t __s2_len___16 ;
6086   int tmp___211 ;   6086   int tmp___211 ;
6087   int tmp___212 ;   6087   int tmp___212 ;
6088   int tmp___213 ;   6088   int tmp___213 ;
6089   unsigned char const   *__s2___16 ;   6089   unsigned char const   *__s2___16 ;
6090   register int __result___33 ;   6090   register int __result___33 ;
6091   int tmp___214 ;   6091   int tmp___214 ;
6092   unsigned char const   *__s1___16 ;   6092   unsigned char const   *__s1___16 ;
6093   register int __result___34 ;   6093   register int __result___34 ;
6094   int tmp___215 ;   6094   int tmp___215 ;
6095   int tmp___216 ;   6095   int tmp___216 ;
6096   int tmp___217 ;   6096   int tmp___217 ;
6097   size_t __s1_len___17 ;   6097   size_t __s1_len___17 ;
6098   size_t __s2_len___17 ;   6098   size_t __s2_len___17 ;
6099   int tmp___218 ;   6099   int tmp___218 ;
6100   int tmp___219 ;   6100   int tmp___219 ;
6101   int tmp___220 ;   6101   int tmp___220 ;
6102   unsigned char const   *__s2___17 ;   6102   unsigned char const   *__s2___17 ;
6103   register int __result___35 ;   6103   register int __result___35 ;
6104   int tmp___221 ;   6104   int tmp___221 ;
6105   unsigned char const   *__s1___17 ;   6105   unsigned char const   *__s1___17 ;
6106   register int __result___36 ;   6106   register int __result___36 ;
6107   int tmp___222 ;   6107   int tmp___222 ;
6108   int tmp___223 ;   6108   int tmp___223 ;
6109   int tmp___224 ;   6109   int tmp___224 ;
6110   int __res___4 ;   6110   int __res___4 ;
6111   int __c___4 ;   6111   int __c___4 ;
6112   __int32_t const   **tmp___225 ;   6112   __int32_t const   **tmp___225 ;
6113   __int32_t const   **tmp___226 ;   6113   __int32_t const   **tmp___226 ;
6114   size_t __s1_len___18 ;   6114   size_t __s1_len___18 ;
6115   size_t __s2_len___18 ;   6115   size_t __s2_len___18 ;
6116   int tmp___227 ;   6116   int tmp___227 ;
6117   int tmp___228 ;   6117   int tmp___228 ;
6118   int tmp___229 ;   6118   int tmp___229 ;
6119   unsigned char const   *__s2___18 ;   6119   unsigned char const   *__s2___18 ;
6120   register int __result___37 ;   6120   register int __result___37 ;
6121   int tmp___230 ;   6121   int tmp___230 ;
6122   unsigned char const   *__s1___18 ;   6122   unsigned char const   *__s1___18 ;
6123   register int __result___38 ;   6123   register int __result___38 ;
6124   int tmp___231 ;   6124   int tmp___231 ;
6125   int tmp___232 ;   6125   int tmp___232 ;
6126   int tmp___233 ;   6126   int tmp___233 ;
6127   int tmp___234 ;   6127   int tmp___234 ;
6128   unsigned long tmp___235 ;   6128   unsigned long tmp___235 ;
6129   char __a0___1 ;   6129   char __a0___1 ;
6130   char __a1___1 ;   6130   char __a1___1 ;
6131   char __a2___1 ;   6131   char __a2___1 ;
6132   char *tmp___236 ;   6132   char *tmp___236 ;
6133   char *tmp___237 ;   6133   char *tmp___237 ;
6134   char *tmp___238 ;   6134   char *tmp___238 ;
6135   char *tmp___239 ;   6135   char *tmp___239 ;
6136   char *tmp___240 ;   6136   char *tmp___240 ;
6137   char *tmp___241 ;   6137   char *tmp___241 ;
6138   char *tmp___242 ;   6138   char *tmp___242 ;
6139   char *tmp___243 ;   6139   char *tmp___243 ;
6140   char *tmp___244 ;   6140   char *tmp___244 ;
6141   char *tmp___245 ;   6141   char *tmp___245 ;
6142   int tmp___246 ;   6142   int tmp___246 ;
6143   int tmp___247 ;   6143   int tmp___247 ;
6144   int tmp___248 ;   6144   int tmp___248 ;
6145   int tmp___249 ;   6145   int tmp___249 ;
6146   size_t __s1_len___19 ;   6146   size_t __s1_len___19 ;
6147   size_t __s2_len___19 ;   6147   size_t __s2_len___19 ;
6148   int tmp___250 ;   6148   int tmp___250 ;
6149   int tmp___251 ;   6149   int tmp___251 ;
6150   int tmp___252 ;   6150   int tmp___252 ;
6151   unsigned char const   *__s2___19 ;   6151   unsigned char const   *__s2___19 ;
6152   register int __result___39 ;   6152   register int __result___39 ;
6153   int tmp___253 ;   6153   int tmp___253 ;
6154   unsigned char const   *__s1___19 ;   6154   unsigned char const   *__s1___19 ;
6155   register int __result___40 ;   6155   register int __result___40 ;
6156   int tmp___254 ;   6156   int tmp___254 ;
6157   int tmp___255 ;   6157   int tmp___255 ;
6158   int tmp___256 ;   6158   int tmp___256 ;
6159   size_t __s1_len___20 ;   6159   size_t __s1_len___20 ;
6160   size_t __s2_len___20 ;   6160   size_t __s2_len___20 ;
6161   int tmp___257 ;   6161   int tmp___257 ;
6162   int tmp___258 ;   6162   int tmp___258 ;
6163   int tmp___259 ;   6163   int tmp___259 ;
6164   unsigned char const   *__s2___20 ;   6164   unsigned char const   *__s2___20 ;
6165   register int __result___41 ;   6165   register int __result___41 ;
6166   int tmp___260 ;   6166   int tmp___260 ;
6167   unsigned char const   *__s1___20 ;   6167   unsigned char const   *__s1___20 ;
6168   register int __result___42 ;   6168   register int __result___42 ;
6169   int tmp___261 ;   6169   int tmp___261 ;
6170   int tmp___262 ;   6170   int tmp___262 ;
6171   int tmp___263 ;   6171   int tmp___263 ;
6172   size_t __s1_len___21 ;   6172   size_t __s1_len___21 ;
6173   size_t __s2_len___21 ;   6173   size_t __s2_len___21 ;
6174   int tmp___264 ;   6174   int tmp___264 ;
6175   int tmp___265 ;   6175   int tmp___265 ;
6176   int tmp___266 ;   6176   int tmp___266 ;
6177   unsigned char const   *__s2___21 ;   6177   unsigned char const   *__s2___21 ;
6178   register int __result___43 ;   6178   register int __result___43 ;
6179   int tmp___267 ;   6179   int tmp___267 ;
6180   unsigned char const   *__s1___21 ;   6180   unsigned char const   *__s1___21 ;
6181   register int __result___44 ;   6181   register int __result___44 ;
6182   int tmp___268 ;   6182   int tmp___268 ;
6183   int tmp___269 ;   6183   int tmp___269 ;
6184   int tmp___270 ;   6184   int tmp___270 ;
6185   void *tmp___271 ;   6185   void *tmp___271 ;
6186   char *tmp___272 ;   6186   char *tmp___272 ;
6187     6187  
6188   {   6188   {
6189   good_args = 0;   6189   good_args = 0;
6190   opt_offset = (char *)((void *)0);   6190   opt_offset = (char *)((void *)0);
6191   opt_ptr = (char *)((void *)0);   6191   opt_ptr = (char *)((void *)0);
6192   sep = (char *)((void *)0);   6192   sep = (char *)((void *)0);
6193   tmp = mp;   6193   tmp = mp;
6194   mp ++;   6194   mp ++;
6195   *tmp = (char )'w';   6195   *tmp = (char )'w';
6196   *mp = (char )'\000';   6196   *mp = (char )'\000';
6197   while (1) {   6197   while (1) {
6198     c = getopt(argc, (char * const  *)argv,   6198     c = getopt(argc, (char * const  *)argv,
6199                "ac:d:e:f:hil:m:p:r:stvw:z:BCD:E:F:H:I:J:K:LMN:O:P:R:S:U:V:X:Y:Z:");   6199                "ac:d:e:f:hil:m:p:r:stvw:z:BCD:E:F:H:I:J:K:LMN:O:P:R:S:U:V:X:Y:Z:");
6200     if (c != -1) {   6200     if (c != -1) {
6201     6201  
6202     } else {   6202     } else {
6203       break;   6203       break;
6204     }   6204     }
6205     good_args ++;   6205     good_args ++;
6206     switch (c) {   6206     switch (c) {
6207     case 97:   6207     case 97:
6208     *(mode + 0) = (char )'a';   6208     *(mode + 0) = (char )'a';
6209     break;   6209     break;
6210     case 99:   6210     case 99:
6211     tmp___0 = processCompressOptions(optarg);   6211     tmp___0 = processCompressOptions(optarg);
6212     if (tmp___0) {   6212     if (tmp___0) {
6213     6213  
6214     } else {   6214     } else {
6215       TIFFError("Unknown compression option", "%s", optarg);   6215       TIFFError("Unknown compression option", "%s", optarg);
6216       TIFFError("For valid options type", "tiffcrop -h");   6216       TIFFError("For valid options type", "tiffcrop -h");
6217       exit(-1);   6217       exit(-1);
6218     }   6218     }
6219     break;   6219     break;
6220     case 100:   6220     case 100:
6221     tmp___1 = strtoul((char const   */* __restrict  */)optarg,   6221     tmp___1 = strtoul((char const   */* __restrict  */)optarg,
6222                       (char **/* __restrict  */)((void *)0), 0);   6222                       (char **/* __restrict  */)((void *)0), 0);
6223     start = (unsigned int )tmp___1;   6223     start = (unsigned int )tmp___1;
6224     if (start == 0U) {   6224     if (start == 0U) {
6225       TIFFError("", "Directory offset must be greater than zero");   6225       TIFFError("", "Directory offset must be greater than zero");
6226       TIFFError("For valid options type", "tiffcrop -h");   6226       TIFFError("For valid options type", "tiffcrop -h");
6227       exit(-1);   6227       exit(-1);
6228     } else {   6228     } else {
6229     6229  
6230     }   6230     }
6231     *dirnum = start - 1U;   6231     *dirnum = start - 1U;
6232     break;   6232     break;
6233     case 101:   6233     case 101:
6234     if (sizeof(*(optarg + 0)) > 1U) {   6234     if (sizeof(*(optarg + 0)) > 1U) {
6235       __res = tolower((int )*(optarg + 0));   6235       __res = tolower((int )*(optarg + 0));
6236     } else {   6236     } else {
6237       tmp___3 = __ctype_tolower_loc();   6237       tmp___3 = __ctype_tolower_loc();
6238       __res = (int )*(*tmp___3 + (int )*(optarg + 0));   6238       __res = (int )*(*tmp___3 + (int )*(optarg + 0));
6239     }   6239     }
6240     switch (__res) {   6240     switch (__res) {
6241     case 99:   6241     case 99:
6242     crop_data->exp_mode = (uint16 )0;   6242     crop_data->exp_mode = (uint16 )0;
6243     crop_data->img_mode = (uint16 )0;   6243     crop_data->img_mode = (uint16 )0;
6244     break;   6244     break;
6245     case 100:   6245     case 100:
6246     crop_data->exp_mode = (uint16 )1;   6246     crop_data->exp_mode = (uint16 )1;
6247     crop_data->img_mode = (uint16 )1;   6247     crop_data->img_mode = (uint16 )1;
6248     break;   6248     break;
6249     case 105:   6249     case 105:
6250     crop_data->exp_mode = (uint16 )2;   6250     crop_data->exp_mode = (uint16 )2;
6251     crop_data->img_mode = (uint16 )0;   6251     crop_data->img_mode = (uint16 )0;
6252     break;   6252     break;
6253     case 109:   6253     case 109:
6254     crop_data->exp_mode = (uint16 )3;   6254     crop_data->exp_mode = (uint16 )3;
6255     crop_data->img_mode = (uint16 )1;   6255     crop_data->img_mode = (uint16 )1;
6256     break;   6256     break;
6257     case 115:   6257     case 115:
6258     crop_data->exp_mode = (uint16 )4;   6258     crop_data->exp_mode = (uint16 )4;
6259     crop_data->img_mode = (uint16 )1;   6259     crop_data->img_mode = (uint16 )1;
6260     break;   6260     break;
6261     default:   6261     default:
6262     TIFFError("Unknown export mode", "%s", optarg);   6262     TIFFError("Unknown export mode", "%s", optarg);
6263     TIFFError("For valid options type", "tiffcrop -h");   6263     TIFFError("For valid options type", "tiffcrop -h");
6264     exit(-1);   6264     exit(-1);
6265     }   6265     }
6266     break;   6266     break;
6267     case 102:   6267     case 102:
6268     if (0) {   6268     if (0) {
6269       __s1_len___0 = strlen((char const   *)optarg);   6269       __s1_len___0 = strlen((char const   *)optarg);
6270       __s2_len___0 = strlen("lsb2msb");   6270       __s2_len___0 = strlen("lsb2msb");
6271       if (! ((size_t )((void const   *)(optarg + 1)) - (size_t )((void const   *)optarg) == 1U)) {   6271       if (! ((size_t )((void const   *)(optarg + 1)) - (size_t )((void const   *)optarg) == 1U)) {
6272         goto _L___2;   6272         goto _L___2;
6273       } else   6273       } else
6274       if (__s1_len___0 >= 4U) {   6274       if (__s1_len___0 >= 4U) {
6275         _L___2: /* CIL Label */   6275         _L___2: /* CIL Label */
6276         if (! ((size_t )((void const   *)("lsb2msb" + 1)) - (size_t )((void const   *)"lsb2msb") == 1U)) {   6276         if (! ((size_t )((void const   *)("lsb2msb" + 1)) - (size_t )((void const   *)"lsb2msb") == 1U)) {
6277           tmp___17 = 1;   6277           tmp___17 = 1;
6278         } else   6278         } else
6279         if (__s2_len___0 >= 4U) {   6279         if (__s2_len___0 >= 4U) {
6280           tmp___17 = 1;   6280           tmp___17 = 1;
6281         } else {   6281         } else {
6282           tmp___17 = 0;   6282           tmp___17 = 0;
6283         }   6283         }
6284       } else {   6284       } else {
6285         tmp___17 = 0;   6285         tmp___17 = 0;
6286       }   6286       }
6287       if (tmp___17) {   6287       if (tmp___17) {
6288         tmp___12 = __builtin_strcmp((char const   *)optarg, "lsb2msb");   6288         tmp___12 = __builtin_strcmp((char const   *)optarg, "lsb2msb");
6289         tmp___16 = tmp___12;   6289         tmp___16 = tmp___12;
6290       } else {   6290       } else {
6291         tmp___15 = __builtin_strcmp((char const   *)optarg, "lsb2msb");   6291         tmp___15 = __builtin_strcmp((char const   *)optarg, "lsb2msb");
6292         tmp___16 = tmp___15;   6292         tmp___16 = tmp___15;
6293       }   6293       }
6294     } else {   6294     } else {
6295       tmp___15 = __builtin_strcmp((char const   *)optarg, "lsb2msb");   6295       tmp___15 = __builtin_strcmp((char const   *)optarg, "lsb2msb");
6296       tmp___16 = tmp___15;   6296       tmp___16 = tmp___15;
6297     }   6297     }
6298     if (tmp___16 == 0) {   6298     if (tmp___16 == 0) {
6299       *deffillorder = (uint16 )2;   6299       *deffillorder = (uint16 )2;
6300     } else {   6300     } else {
6301       if (0) {   6301       if (0) {
6302         __s1_len = strlen((char const   *)optarg);   6302         __s1_len = strlen((char const   *)optarg);
6303         __s2_len = strlen("msb2lsb");   6303         __s2_len = strlen("msb2lsb");
6304         if (! ((size_t )((void const   *)(optarg + 1)) - (size_t )((void const   *)optarg) == 1U)) {   6304         if (! ((size_t )((void const   *)(optarg + 1)) - (size_t )((void const   *)optarg) == 1U)) {
6305           goto _L___0;   6305           goto _L___0;
6306         } else   6306         } else
6307         if (__s1_len >= 4U) {   6307         if (__s1_len >= 4U) {
6308           _L___0: /* CIL Label */   6308           _L___0: /* CIL Label */
6309           if (! ((size_t )((void const   *)("msb2lsb" + 1)) - (size_t )((void const   *)"msb2lsb") == 1U)) {   6309           if (! ((size_t )((void const   *)("msb2lsb" + 1)) - (size_t )((void const   *)"msb2lsb") == 1U)) {
6310             tmp___10 = 1;   6310             tmp___10 = 1;
6311           } else   6311           } else
6312           if (__s2_len >= 4U) {   6312           if (__s2_len >= 4U) {
6313             tmp___10 = 1;   6313             tmp___10 = 1;
6314           } else {   6314           } else {
6315             tmp___10 = 0;   6315             tmp___10 = 0;
6316           }   6316           }
6317         } else {   6317         } else {
6318           tmp___10 = 0;   6318           tmp___10 = 0;
6319         }   6319         }
6320         if (tmp___10) {   6320         if (tmp___10) {
6321           tmp___5 = __builtin_strcmp((char const   *)optarg, "msb2lsb");   6321           tmp___5 = __builtin_strcmp((char const   *)optarg, "msb2lsb");
6322           tmp___9 = tmp___5;   6322           tmp___9 = tmp___5;
6323         } else {   6323         } else {
6324           tmp___8 = __builtin_strcmp((char const   *)optarg, "msb2lsb");   6324           tmp___8 = __builtin_strcmp((char const   *)optarg, "msb2lsb");
6325           tmp___9 = tmp___8;   6325           tmp___9 = tmp___8;
6326         }   6326         }
6327       } else {   6327       } else {
6328         tmp___8 = __builtin_strcmp((char const   *)optarg, "msb2lsb");   6328         tmp___8 = __builtin_strcmp((char const   *)optarg, "msb2lsb");
6329         tmp___9 = tmp___8;   6329         tmp___9 = tmp___8;
6330       }   6330       }
6331       if (tmp___9 == 0) {   6331       if (tmp___9 == 0) {
6332         *deffillorder = (uint16 )1;   6332         *deffillorder = (uint16 )1;
6333       } else {   6333       } else {
6334         TIFFError("Unknown fill order", "%s", optarg);   6334         TIFFError("Unknown fill order", "%s", optarg);
6335         TIFFError("For valid options type", "tiffcrop -h");   6335         TIFFError("For valid options type", "tiffcrop -h");
6336         exit(-1);   6336         exit(-1);
6337       }   6337       }
6338     }   6338     }
6339     break;   6339     break;
6340     case 104:   6340     case 104:
6341     usage();   6341     usage();
6342     break;   6342     break;
6343     case 105:   6343     case 105:
6344     ignore = 1;   6344     ignore = 1;
6345     break;   6345     break;
6346     case 108:   6346     case 108:
6347     outtiled = 1;   6347     outtiled = 1;
6348     tmp___18 = atoi((char const   *)optarg);   6348     tmp___18 = atoi((char const   *)optarg);
6349     *deftilelength = (uint32 )tmp___18;   6349     *deftilelength = (uint32 )tmp___18;
6350     break;   6350     break;
6351     case 112:   6351     case 112:
6352     if (0) {   6352     if (0) {
6353       __s1_len___2 = strlen((char const   *)optarg);   6353       __s1_len___2 = strlen((char const   *)optarg);
6354       __s2_len___2 = strlen("separate");   6354       __s2_len___2 = strlen("separate");
6355       if (! ((size_t )((void const   *)(optarg + 1)) - (size_t )((void const   *)optarg) == 1U)) {   6355       if (! ((size_t )((void const   *)(optarg + 1)) - (size_t )((void const   *)optarg) == 1U)) {
6356         goto _L___6;   6356         goto _L___6;
6357       } else   6357       } else
6358       if (__s1_len___2 >= 4U) {   6358       if (__s1_len___2 >= 4U) {
6359         _L___6: /* CIL Label */   6359         _L___6: /* CIL Label */
6360         if (! ((size_t )((void const   *)("separate" + 1)) - (size_t )((void const   *)"separate") == 1U)) {   6360         if (! ((size_t )((void const   *)("separate" + 1)) - (size_t )((void const   *)"separate") == 1U)) {
6361           tmp___32 = 1;   6361           tmp___32 = 1;
6362         } else   6362         } else
6363         if (__s2_len___2 >= 4U) {   6363         if (__s2_len___2 >= 4U) {
6364           tmp___32 = 1;   6364           tmp___32 = 1;
6365         } else {   6365         } else {
6366           tmp___32 = 0;   6366           tmp___32 = 0;
6367         }   6367         }
6368       } else {   6368       } else {
6369         tmp___32 = 0;   6369         tmp___32 = 0;
6370       }   6370       }
6371       if (tmp___32) {   6371       if (tmp___32) {
6372         tmp___27 = __builtin_strcmp((char const   *)optarg, "separate");   6372         tmp___27 = __builtin_strcmp((char const   *)optarg, "separate");
6373         tmp___31 = tmp___27;   6373         tmp___31 = tmp___27;
6374       } else {   6374       } else {
6375         tmp___30 = __builtin_strcmp((char const   *)optarg, "separate");   6375         tmp___30 = __builtin_strcmp((char const   *)optarg, "separate");
6376         tmp___31 = tmp___30;   6376         tmp___31 = tmp___30;
6377       }   6377       }
6378     } else {   6378     } else {
6379       tmp___30 = __builtin_strcmp((char const   *)optarg, "separate");   6379       tmp___30 = __builtin_strcmp((char const   *)optarg, "separate");
6380       tmp___31 = tmp___30;   6380       tmp___31 = tmp___30;
6381     }   6381     }
6382     if (tmp___31 == 0) {   6382     if (tmp___31 == 0) {
6383       *defconfig = (uint16 )2;   6383       *defconfig = (uint16 )2;
6384     } else {   6384     } else {
6385       if (0) {   6385       if (0) {
6386         __s1_len___1 = strlen((char const   *)optarg);   6386         __s1_len___1 = strlen((char const   *)optarg);
6387         __s2_len___1 = strlen("contig");   6387         __s2_len___1 = strlen("contig");
6388         if (! ((size_t )((void const   *)(optarg + 1)) - (size_t )((void const   *)optarg) == 1U)) {   6388         if (! ((size_t )((void const   *)(optarg + 1)) - (size_t )((void const   *)optarg) == 1U)) {
6389           goto _L___4;   6389           goto _L___4;
6390         } else   6390         } else
6391         if (__s1_len___1 >= 4U) {   6391         if (__s1_len___1 >= 4U) {
6392           _L___4: /* CIL Label */   6392           _L___4: /* CIL Label */
6393           if (! ((size_t )((void const   *)("contig" + 1)) - (size_t )((void const   *)"contig") == 1U)) {   6393           if (! ((size_t )((void const   *)("contig" + 1)) - (size_t )((void const   *)"contig") == 1U)) {
6394             tmp___25 = 1;   6394             tmp___25 = 1;
6395           } else   6395           } else
6396           if (__s2_len___1 >= 4U) {   6396           if (__s2_len___1 >= 4U) {
6397             tmp___25 = 1;   6397             tmp___25 = 1;
6398           } else {   6398           } else {
6399             tmp___25 = 0;   6399             tmp___25 = 0;
6400           }   6400           }
6401         } else {   6401         } else {
6402           tmp___25 = 0;   6402           tmp___25 = 0;
6403         }   6403         }
6404         if (tmp___25) {   6404         if (tmp___25) {
6405           tmp___20 = __builtin_strcmp((char const   *)optarg, "contig");   6405           tmp___20 = __builtin_strcmp((char const   *)optarg, "contig");
6406           tmp___24 = tmp___20;   6406           tmp___24 = tmp___20;
6407         } else {   6407         } else {
6408           tmp___23 = __builtin_strcmp((char const   *)optarg, "contig");   6408           tmp___23 = __builtin_strcmp((char const   *)optarg, "contig");
6409           tmp___24 = tmp___23;   6409           tmp___24 = tmp___23;
6410         }   6410         }
6411       } else {   6411       } else {
6412         tmp___23 = __builtin_strcmp((char const   *)optarg, "contig");   6412         tmp___23 = __builtin_strcmp((char const   *)optarg, "contig");
6413         tmp___24 = tmp___23;   6413         tmp___24 = tmp___23;
6414       }   6414       }
6415       if (tmp___24 == 0) {   6415       if (tmp___24 == 0) {
6416         *defconfig = (uint16 )1;   6416         *defconfig = (uint16 )1;
6417       } else {   6417       } else {
6418         TIFFError("Unkown planar configuration", "%s", optarg);   6418         TIFFError("Unkown planar configuration", "%s", optarg);
6419         TIFFError("For valid options type", "tiffcrop -h");   6419         TIFFError("For valid options type", "tiffcrop -h");
6420         exit(-1);   6420         exit(-1);
6421       }   6421       }
6422     }   6422     }
6423     break;   6423     break;
6424     case 114:   6424     case 114:
6425     tmp___33 = atol((char const   *)optarg);   6425     tmp___33 = atol((char const   *)optarg);
6426     *defrowsperstrip = (uint32 )tmp___33;   6426     *defrowsperstrip = (uint32 )tmp___33;
6427     break;   6427     break;
6428     case 115:   6428     case 115:
6429     outtiled = 0;   6429     outtiled = 0;
6430     break;   6430     break;
6431     case 116:   6431     case 116:
6432     outtiled = 1;   6432     outtiled = 1;
6433     break;   6433     break;
6434     case 118:   6434     case 118:
6435     TIFFError("Tiffcrop version", "%s, last updated: %s", tiffcrop_version_id,   6435     TIFFError("Tiffcrop version", "%s, last updated: %s", tiffcrop_version_id,
6436               tiffcrop_rev_date);   6436               tiffcrop_rev_date);
6437     TIFFError("Tiffcp code", "Copyright (c) 1988-1997 Sam Leffler");   6437     TIFFError("Tiffcp code", "Copyright (c) 1988-1997 Sam Leffler");
6438     TIFFError("           ", "Copyright (c) 1991-1997 Silicon Graphics, Inc");   6438     TIFFError("           ", "Copyright (c) 1991-1997 Silicon Graphics, Inc");
6439     TIFFError("Tiffcrop additions", "Copyright (c) 2007-2009 Richard Nolde");   6439     TIFFError("Tiffcrop additions", "Copyright (c) 2007-2009 Richard Nolde");
6440     exit(0);   6440     exit(0);
6441     break;   6441     break;
6442     case 119:   6442     case 119:
6443     outtiled = 1;   6443     outtiled = 1;
6444     tmp___34 = atoi((char const   *)optarg);   6444     tmp___34 = atoi((char const   *)optarg);
6445     *deftilewidth = (uint32 )tmp___34;   6445     *deftilewidth = (uint32 )tmp___34;
6446     break;   6446     break;
6447     case 122:   6447     case 122:
6448     crop_data->crop_mode = (uint16 )((int )crop_data->crop_mode | 16);   6448     crop_data->crop_mode = (uint16 )((int )crop_data->crop_mode | 16);
6449     i = 0U;   6449     i = 0U;
6450     opt_ptr = strtok((char */* __restrict  */)optarg,   6450     opt_ptr = strtok((char */* __restrict  */)optarg,
6451                      (char const   */* __restrict  */)":");   6451                      (char const   */* __restrict  */)":");
6452     while (1) {   6452     while (1) {
6453       if ((unsigned int )opt_ptr != (unsigned int )((void *)0)) {   6453       if ((unsigned int )opt_ptr != (unsigned int )((void *)0)) {
6454         if (i < 8U) {   6454         if (i < 8U) {
6455     6455  
6456         } else {   6456         } else {
6457           break;   6457           break;
6458         }   6458         }
6459       } else {   6459       } else {
6460         break;   6460         break;
6461       }   6461       }
6462       crop_data->regions = (uint16 )((int )crop_data->regions + 1);   6462       crop_data->regions = (uint16 )((int )crop_data->regions + 1);
6463       tmp___35 = sscanf((char const   */* __restrict  */)opt_ptr,   6463       tmp___35 = sscanf((char const   */* __restrict  */)opt_ptr,
6464                         (char const   */* __restrict  */)"%lf,%lf,%lf,%lf",   6464                         (char const   */* __restrict  */)"%lf,%lf,%lf,%lf",
6465                         & crop_data->corners[i].X1, & crop_data->corners[i].Y1,   6465                         & crop_data->corners[i].X1, & crop_data->corners[i].Y1,
6466                         & crop_data->corners[i].X2, & crop_data->corners[i].Y2);   6466                         & crop_data->corners[i].X2, & crop_data->corners[i].Y2);
6467       if (tmp___35 != 4) {   6467       if (tmp___35 != 4) {
6468         TIFFError("Unable to parse coordinates for region", "%d %s", i, optarg);   6468         TIFFError("Unable to parse coordinates for region", "%d %s", i, optarg);
6469         TIFFError("For valid options type", "tiffcrop -h");   6469         TIFFError("For valid options type", "tiffcrop -h");
6470         exit(-1);   6470         exit(-1);
6471       } else {   6471       } else {
6472     6472  
6473       }   6473       }
6474       opt_ptr = strtok((char */* __restrict  */)((void *)0),   6474       opt_ptr = strtok((char */* __restrict  */)((void *)0),
6475                        (char const   */* __restrict  */)":");   6475                        (char const   */* __restrict  */)":");
6476       i ++;   6476       i ++;
6477     }   6477     }
6478     if ((unsigned int )opt_ptr != (unsigned int )((void *)0)) {   6478     if ((unsigned int )opt_ptr != (unsigned int )((void *)0)) {
6479       if (i >= 8U) {   6479       if (i >= 8U) {
6480         TIFFError("Region list exceeds limit of", "%d regions %s", 8, optarg);   6480         TIFFError("Region list exceeds limit of", "%d regions %s", 8, optarg);
6481         TIFFError("For valid options type", "tiffcrop -h");   6481         TIFFError("For valid options type", "tiffcrop -h");
6482         exit(-1);   6482         exit(-1);
6483       } else {   6483       } else {
6484     6484  
6485       }   6485       }
6486     } else {   6486     } else {
6487     6487  
6488     }   6488     }
6489     break;   6489     break;
6490     case 66:   6490     case 66:
6491     tmp___36 = mp;   6491     tmp___36 = mp;
6492     mp ++;   6492     mp ++;
6493     *tmp___36 = (char )'b';   6493     *tmp___36 = (char )'b';
6494     *mp = (char )'\000';   6494     *mp = (char )'\000';
6495     break;   6495     break;
6496     case 76:   6496     case 76:
6497     tmp___37 = mp;   6497     tmp___37 = mp;
6498     mp ++;   6498     mp ++;
6499     *tmp___37 = (char )'l';   6499     *tmp___37 = (char )'l';
6500     *mp = (char )'\000';   6500     *mp = (char )'\000';
6501     break;   6501     break;
6502     case 77:   6502     case 77:
6503     tmp___38 = mp;   6503     tmp___38 = mp;
6504     mp ++;   6504     mp ++;
6505     *tmp___38 = (char )'m';   6505     *tmp___38 = (char )'m';
6506     *mp = (char )'\000';   6506     *mp = (char )'\000';
6507     break;   6507     break;
6508     case 67:   6508     case 67:
6509     tmp___39 = mp;   6509     tmp___39 = mp;
6510     mp ++;   6510     mp ++;
6511     *tmp___39 = (char )'c';   6511     *tmp___39 = (char )'c';
6512     *mp = (char )'\000';   6512     *mp = (char )'\000';
6513     break;   6513     break;
6514     case 68:   6514     case 68:
6515     i = 0U;   6515     i = 0U;
6516     opt_ptr = strtok((char */* __restrict  */)optarg,   6516     opt_ptr = strtok((char */* __restrict  */)optarg,
6517                      (char const   */* __restrict  */)",");   6517                      (char const   */* __restrict  */)",");
6518     while ((unsigned int )opt_ptr != (unsigned int )((void *)0)) {   6518     while ((unsigned int )opt_ptr != (unsigned int )((void *)0)) {
6519       tmp___49 = __builtin_strpbrk((char const   *)opt_ptr, ":=");   6519       tmp___49 = __builtin_strpbrk((char const   *)opt_ptr, ":=");
6520       opt_offset = tmp___49;   6520       opt_offset = tmp___49;
6521       if ((unsigned int )opt_offset == (unsigned int )((void *)0)) {   6521       if ((unsigned int )opt_offset == (unsigned int )((void *)0)) {
6522         TIFFError("Invalid dump option", "%s", optarg);   6522         TIFFError("Invalid dump option", "%s", optarg);
6523         TIFFError("For valid options type", "tiffcrop -h");   6523         TIFFError("For valid options type", "tiffcrop -h");
6524         exit(-1);   6524         exit(-1);
6525       } else {   6525       } else {
6526     6526  
6527       }   6527       }
6528       *opt_offset = (char )'\000';   6528       *opt_offset = (char )'\000';
6529       end = strlen((char const   *)opt_ptr);   6529       end = strlen((char const   *)opt_ptr);
6530       i = 0U;   6530       i = 0U;
6531       while (i < end) {   6531       while (i < end) {
6532         if (sizeof(*(opt_ptr + i)) > 1U) {   6532         if (sizeof(*(opt_ptr + i)) > 1U) {
6533           __res___0 = tolower((int )*(opt_ptr + i));   6533           __res___0 = tolower((int )*(opt_ptr + i));
6534         } else {   6534         } else {
6535           tmp___51 = __ctype_tolower_loc();   6535           tmp___51 = __ctype_tolower_loc();
6536           __res___0 = (int )*(*tmp___51 + (int )*(opt_ptr + i));   6536           __res___0 = (int )*(*tmp___51 + (int )*(opt_ptr + i));
6537         }   6537         }
6538         *(opt_ptr + i) = (char )__res___0;   6538         *(opt_ptr + i) = (char )__res___0;
6539         i ++;   6539         i ++;
6540       }   6540       }
6541       if (0) {   6541       if (0) {
6542         if (0) {   6542         if (0) {
6543           __s1_len___9 = strlen((char const   *)opt_ptr);   6543           __s1_len___9 = strlen((char const   *)opt_ptr);
6544           __s2_len___9 = strlen("for");   6544           __s2_len___9 = strlen("for");
6545           if (! ((size_t )((void const   *)(opt_ptr + 1)) - (size_t )((void const   *)opt_ptr) == 1U)) {   6545           if (! ((size_t )((void const   *)(opt_ptr + 1)) - (size_t )((void const   *)opt_ptr) == 1U)) {
6546             goto _L___20;   6546             goto _L___20;
6547           } else   6547           } else
6548           if (__s1_len___9 >= 4U) {   6548           if (__s1_len___9 >= 4U) {
6549             _L___20: /* CIL Label */   6549             _L___20: /* CIL Label */
6550             if (! ((size_t )((void const   *)("for" + 1)) - (size_t )((void const   *)"for") == 1U)) {   6550             if (! ((size_t )((void const   *)("for" + 1)) - (size_t )((void const   *)"for") == 1U)) {
6551               tmp___140 = 1;   6551               tmp___140 = 1;
6552             } else   6552             } else
6553             if (__s2_len___9 >= 4U) {   6553             if (__s2_len___9 >= 4U) {
6554               tmp___140 = 1;   6554               tmp___140 = 1;
6555             } else {   6555             } else {
6556               tmp___140 = 0;   6556               tmp___140 = 0;
6557             }   6557             }
6558           } else {   6558           } else {
6559             tmp___140 = 0;   6559             tmp___140 = 0;
6560           }   6560           }
6561           if (tmp___140) {   6561           if (tmp___140) {
6562             tmp___135 = __builtin_strcmp((char const   *)opt_ptr, "for");   6562             tmp___135 = __builtin_strcmp((char const   *)opt_ptr, "for");
6563             tmp___139 = tmp___135;   6563             tmp___139 = tmp___135;
6564           } else {   6564           } else {
6565             tmp___138 = __builtin_strcmp((char const   *)opt_ptr, "for");   6565             tmp___138 = __builtin_strcmp((char const   *)opt_ptr, "for");
6566             tmp___139 = tmp___138;   6566             tmp___139 = tmp___138;
6567           }   6567           }
6568         } else {   6568         } else {
6569           tmp___138 = __builtin_strcmp((char const   *)opt_ptr, "for");   6569           tmp___138 = __builtin_strcmp((char const   *)opt_ptr, "for");
6570           tmp___139 = tmp___138;   6570           tmp___139 = tmp___138;
6571         }   6571         }
6572         tmp___142 = tmp___139;   6572         tmp___142 = tmp___139;
6573       } else {   6573       } else {
6574         tmp___141 = strncmp((char const   *)opt_ptr, "for", (size_t )3);   6574         tmp___141 = strncmp((char const   *)opt_ptr, "for", (size_t )3);
6575         tmp___142 = tmp___141;   6575         tmp___142 = tmp___141;
6576       }   6576       }
6577       if (tmp___142 == 0) {   6577       if (tmp___142 == 0) {
6578         end = strlen((char const   *)(opt_offset + 1));   6578         end = strlen((char const   *)(opt_offset + 1));
6579         i = 1U;   6579         i = 1U;
6580         while (i <= end) {   6580         while (i <= end) {
6581           if (sizeof(*(opt_offset + i)) > 1U) {   6581           if (sizeof(*(opt_offset + i)) > 1U) {
6582             __res___1 = tolower((int )*(opt_offset + i));   6582             __res___1 = tolower((int )*(opt_offset + i));
6583           } else {   6583           } else {
6584             tmp___53 = __ctype_tolower_loc();   6584             tmp___53 = __ctype_tolower_loc();
6585             __res___1 = (int )*(*tmp___53 + (int )*(opt_offset + i));   6585             __res___1 = (int )*(*tmp___53 + (int )*(opt_offset + i));
6586           }   6586           }
6587           *(opt_offset + i) = (char )__res___1;   6587           *(opt_offset + i) = (char )__res___1;
6588           i ++;   6588           i ++;
6589         }   6589         }
6590         if (0) {   6590         if (0) {
6591           if (0) {   6591           if (0) {
6592             __s1_len___4 = strlen((char const   *)(opt_offset + 1));   6592             __s1_len___4 = strlen((char const   *)(opt_offset + 1));
6593             __s2_len___4 = strlen("txt");   6593             __s2_len___4 = strlen("txt");
6594             if (! ((size_t )((void const   *)((opt_offset + 1) + 1)) - (size_t )((void const   *)(opt_offset + 1)) == 1U)) {   6594             if (! ((size_t )((void const   *)((opt_offset + 1) + 1)) - (size_t )((void const   *)(opt_offset + 1)) == 1U)) {
6595               goto _L___10;   6595               goto _L___10;
6596             } else   6596             } else
6597             if (__s1_len___4 >= 4U) {   6597             if (__s1_len___4 >= 4U) {
6598               _L___10: /* CIL Label */   6598               _L___10: /* CIL Label */
6599               if (! ((size_t )((void const   *)("txt" + 1)) - (size_t )((void const   *)"txt") == 1U)) {   6599               if (! ((size_t )((void const   *)("txt" + 1)) - (size_t )((void const   *)"txt") == 1U)) {
6600                 tmp___75 = 1;   6600                 tmp___75 = 1;
6601               } else   6601               } else
6602               if (__s2_len___4 >= 4U) {   6602               if (__s2_len___4 >= 4U) {
6603                 tmp___75 = 1;   6603                 tmp___75 = 1;
6604               } else {   6604               } else {
6605                 tmp___75 = 0;   6605                 tmp___75 = 0;
6606               }   6606               }
6607             } else {   6607             } else {
6608               tmp___75 = 0;   6608               tmp___75 = 0;
6609             }   6609             }
6610             if (tmp___75) {   6610             if (tmp___75) {
6611               tmp___70 = __builtin_strcmp((char const   *)(opt_offset + 1),   6611               tmp___70 = __builtin_strcmp((char const   *)(opt_offset + 1),
6612                                           "txt");   6612                                           "txt");
6613               tmp___74 = tmp___70;   6613               tmp___74 = tmp___70;
6614             } else {   6614             } else {
6615               tmp___73 = __builtin_strcmp((char const   *)(opt_offset + 1),   6615               tmp___73 = __builtin_strcmp((char const   *)(opt_offset + 1),
6616                                           "txt");   6616                                           "txt");
6617               tmp___74 = tmp___73;   6617               tmp___74 = tmp___73;
6618             }   6618             }
6619           } else {   6619           } else {
6620             tmp___73 = __builtin_strcmp((char const   *)(opt_offset + 1), "txt");   6620             tmp___73 = __builtin_strcmp((char const   *)(opt_offset + 1), "txt");
6621             tmp___74 = tmp___73;   6621             tmp___74 = tmp___73;
6622           }   6622           }
6623           tmp___77 = tmp___74;   6623           tmp___77 = tmp___74;
6624         } else {   6624         } else {
6625           tmp___76 = strncmp((char const   *)(opt_offset + 1), "txt", (size_t )3);   6625           tmp___76 = strncmp((char const   *)(opt_offset + 1), "txt", (size_t )3);
6626           tmp___77 = tmp___76;   6626           tmp___77 = tmp___76;
6627         }   6627         }
6628         if (tmp___77 == 0) {   6628         if (tmp___77 == 0) {
6629           dump->format = 1;   6629           dump->format = 1;
6630           strcpy((char */* __restrict  */)(dump->mode),   6630           strcpy((char */* __restrict  */)(dump->mode),
6631                  (char const   */* __restrict  */)"w");   6631                  (char const   */* __restrict  */)"w");
6632         } else {   6632         } else {
6633           if (0) {   6633           if (0) {
6634             if (0) {   6634             if (0) {
6635               __s1_len___3 = strlen((char const   *)(opt_offset + 1));   6635               __s1_len___3 = strlen((char const   *)(opt_offset + 1));
6636               __s2_len___3 = strlen("raw");   6636               __s2_len___3 = strlen("raw");
6637               if (! ((size_t )((void const   *)((opt_offset + 1) + 1)) - (size_t )((void const   *)(opt_offset + 1)) == 1U)) {   6637               if (! ((size_t )((void const   *)((opt_offset + 1) + 1)) - (size_t )((void const   *)(opt_offset + 1)) == 1U)) {
6638                 goto _L___8;   6638                 goto _L___8;
6639               } else   6639               } else
6640               if (__s1_len___3 >= 4U) {   6640               if (__s1_len___3 >= 4U) {
6641                 _L___8: /* CIL Label */   6641                 _L___8: /* CIL Label */
6642                 if (! ((size_t )((void const   *)("raw" + 1)) - (size_t )((void const   *)"raw") == 1U)) {   6642                 if (! ((size_t )((void const   *)("raw" + 1)) - (size_t )((void const   *)"raw") == 1U)) {
6643                   tmp___62 = 1;   6643                   tmp___62 = 1;
6644                 } else   6644                 } else
6645                 if (__s2_len___3 >= 4U) {   6645                 if (__s2_len___3 >= 4U) {
6646                   tmp___62 = 1;   6646                   tmp___62 = 1;
6647                 } else {   6647                 } else {
6648                   tmp___62 = 0;   6648                   tmp___62 = 0;
6649                 }   6649                 }
6650               } else {   6650               } else {
6651                 tmp___62 = 0;   6651                 tmp___62 = 0;
6652               }   6652               }
6653               if (tmp___62) {   6653               if (tmp___62) {
6654                 tmp___57 = __builtin_strcmp((char const   *)(opt_offset + 1),   6654                 tmp___57 = __builtin_strcmp((char const   *)(opt_offset + 1),
6655                                             "raw");   6655                                             "raw");
6656                 tmp___61 = tmp___57;   6656                 tmp___61 = tmp___57;
6657               } else {   6657               } else {
6658                 tmp___60 = __builtin_strcmp((char const   *)(opt_offset + 1),   6658                 tmp___60 = __builtin_strcmp((char const   *)(opt_offset + 1),
6659                                             "raw");   6659                                             "raw");
6660                 tmp___61 = tmp___60;   6660                 tmp___61 = tmp___60;
6661               }   6661               }
6662             } else {   6662             } else {
6663               tmp___60 = __builtin_strcmp((char const   *)(opt_offset + 1),   6663               tmp___60 = __builtin_strcmp((char const   *)(opt_offset + 1),
6664                                           "raw");   6664                                           "raw");
6665               tmp___61 = tmp___60;   6665               tmp___61 = tmp___60;
6666             }   6666             }
6667             tmp___64 = tmp___61;   6667             tmp___64 = tmp___61;
6668           } else {   6668           } else {
6669             tmp___63 = strncmp((char const   *)(opt_offset + 1), "raw",   6669             tmp___63 = strncmp((char const   *)(opt_offset + 1), "raw",
6670                                (size_t )3);   6670                                (size_t )3);
6671             tmp___64 = tmp___63;   6671             tmp___64 = tmp___63;
6672           }   6672           }
6673           if (tmp___64 == 0) {   6673           if (tmp___64 == 0) {
6674             dump->format = 2;   6674             dump->format = 2;
6675             strcpy((char */* __restrict  */)(dump->mode),   6675             strcpy((char */* __restrict  */)(dump->mode),
6676                    (char const   */* __restrict  */)"wb");   6676                    (char const   */* __restrict  */)"wb");
6677           } else {   6677           } else {
6678             TIFFError("parse_command_opts", "Unknown dump format %s",   6678             TIFFError("parse_command_opts", "Unknown dump format %s",
6679                       opt_offset + 1);   6679                       opt_offset + 1);
6680             TIFFError("For valid options type", "tiffcrop -h");   6680             TIFFError("For valid options type", "tiffcrop -h");
6681             exit(-1);   6681             exit(-1);
6682           }   6682           }
6683         }   6683         }
6684       } else {   6684       } else {
6685         if (0) {   6685         if (0) {
6686           if (0) {   6686           if (0) {
6687             __s1_len___5 = strlen((char const   *)opt_ptr);   6687             __s1_len___5 = strlen((char const   *)opt_ptr);
6688             __s2_len___5 = strlen("lev");   6688             __s2_len___5 = strlen("lev");
6689             if (! ((size_t )((void const   *)(opt_ptr + 1)) - (size_t )((void const   *)opt_ptr) == 1U)) {   6689             if (! ((size_t )((void const   *)(opt_ptr + 1)) - (size_t )((void const   *)opt_ptr) == 1U)) {
6690               goto _L___12;   6690               goto _L___12;
6691             } else   6691             } else
6692             if (__s1_len___5 >= 4U) {   6692             if (__s1_len___5 >= 4U) {
6693               _L___12: /* CIL Label */   6693               _L___12: /* CIL Label */
6694               if (! ((size_t )((void const   *)("lev" + 1)) - (size_t )((void const   *)"lev") == 1U)) {   6694               if (! ((size_t )((void const   *)("lev" + 1)) - (size_t )((void const   *)"lev") == 1U)) {
6695                 tmp___88 = 1;   6695                 tmp___88 = 1;
6696               } else   6696               } else
6697               if (__s2_len___5 >= 4U) {   6697               if (__s2_len___5 >= 4U) {
6698                 tmp___88 = 1;   6698                 tmp___88 = 1;
6699               } else {   6699               } else {
6700                 tmp___88 = 0;   6700                 tmp___88 = 0;
6701               }   6701               }
6702             } else {   6702             } else {
6703               tmp___88 = 0;   6703               tmp___88 = 0;
6704             }   6704             }
6705             if (tmp___88) {   6705             if (tmp___88) {
6706               tmp___83 = __builtin_strcmp((char const   *)opt_ptr, "lev");   6706               tmp___83 = __builtin_strcmp((char const   *)opt_ptr, "lev");
6707               tmp___87 = tmp___83;   6707               tmp___87 = tmp___83;
6708             } else {   6708             } else {
6709               tmp___86 = __builtin_strcmp((char const   *)opt_ptr, "lev");   6709               tmp___86 = __builtin_strcmp((char const   *)opt_ptr, "lev");
6710               tmp___87 = tmp___86;   6710               tmp___87 = tmp___86;
6711             }   6711             }
6712           } else {   6712           } else {
6713             tmp___86 = __builtin_strcmp((char const   *)opt_ptr, "lev");   6713             tmp___86 = __builtin_strcmp((char const   *)opt_ptr, "lev");
6714             tmp___87 = tmp___86;   6714             tmp___87 = tmp___86;
6715           }   6715           }
6716           tmp___90 = tmp___87;   6716           tmp___90 = tmp___87;
6717         } else {   6717         } else {
6718           tmp___89 = strncmp((char const   *)opt_ptr, "lev", (size_t )3);   6718           tmp___89 = strncmp((char const   *)opt_ptr, "lev", (size_t )3);
6719           tmp___90 = tmp___89;   6719           tmp___90 = tmp___89;
6720         }   6720         }
6721         if (tmp___90 == 0) {   6721         if (tmp___90 == 0) {
6722           dump->level = atoi((char const   *)(opt_offset + 1));   6722           dump->level = atoi((char const   *)(opt_offset + 1));
6723         } else {   6723         } else {
6724     6724  
6725         }   6725         }
6726         if (0) {   6726         if (0) {
6727           if (0) {   6727           if (0) {
6728             __s1_len___6 = strlen((char const   *)opt_ptr);   6728             __s1_len___6 = strlen((char const   *)opt_ptr);
6729             __s2_len___6 = strlen("in");   6729             __s2_len___6 = strlen("in");
6730             if (! ((size_t )((void const   *)(opt_ptr + 1)) - (size_t )((void const   *)opt_ptr) == 1U)) {   6730             if (! ((size_t )((void const   *)(opt_ptr + 1)) - (size_t )((void const   *)opt_ptr) == 1U)) {
6731               goto _L___14;   6731               goto _L___14;
6732             } else   6732             } else
6733             if (__s1_len___6 >= 4U) {   6733             if (__s1_len___6 >= 4U) {
6734               _L___14: /* CIL Label */   6734               _L___14: /* CIL Label */
6735               if (! ((size_t )((void const   *)("in" + 1)) - (size_t )((void const   *)"in") == 1U)) {   6735               if (! ((size_t )((void const   *)("in" + 1)) - (size_t )((void const   *)"in") == 1U)) {
6736                 tmp___101 = 1;   6736                 tmp___101 = 1;
6737               } else   6737               } else
6738               if (__s2_len___6 >= 4U) {   6738               if (__s2_len___6 >= 4U) {
6739                 tmp___101 = 1;   6739                 tmp___101 = 1;
6740               } else {   6740               } else {
6741                 tmp___101 = 0;   6741                 tmp___101 = 0;
6742               }   6742               }
6743             } else {   6743             } else {
6744               tmp___101 = 0;   6744               tmp___101 = 0;
6745             }   6745             }
6746             if (tmp___101) {   6746             if (tmp___101) {
6747               tmp___96 = __builtin_strcmp((char const   *)opt_ptr, "in");   6747               tmp___96 = __builtin_strcmp((char const   *)opt_ptr, "in");
6748               tmp___100 = tmp___96;   6748               tmp___100 = tmp___96;
6749             } else {   6749             } else {
6750               tmp___99 = __builtin_strcmp((char const   *)opt_ptr, "in");   6750               tmp___99 = __builtin_strcmp((char const   *)opt_ptr, "in");
6751               tmp___100 = tmp___99;   6751               tmp___100 = tmp___99;
6752             }   6752             }
6753           } else {   6753           } else {
6754             tmp___99 = __builtin_strcmp((char const   *)opt_ptr, "in");   6754             tmp___99 = __builtin_strcmp((char const   *)opt_ptr, "in");
6755             tmp___100 = tmp___99;   6755             tmp___100 = tmp___99;
6756           }   6756           }
6757           tmp___103 = tmp___100;   6757           tmp___103 = tmp___100;
6758         } else {   6758         } else {
6759           tmp___102 = strncmp((char const   *)opt_ptr, "in", (size_t )2);   6759           tmp___102 = strncmp((char const   *)opt_ptr, "in", (size_t )2);
6760           tmp___103 = tmp___102;   6760           tmp___103 = tmp___102;
6761         }   6761         }
6762         if (tmp___103 == 0) {   6762         if (tmp___103 == 0) {
6763           __builtin_strncpy(dump->infilename, (char const   *)(opt_offset + 1),   6763           __builtin_strncpy(dump->infilename, (char const   *)(opt_offset + 1),
6764                             4076U);   6764                             4076U);
6765         } else {   6765         } else {
6766     6766  
6767         }   6767         }
6768         if (0) {   6768         if (0) {
6769           if (0) {   6769           if (0) {
6770             __s1_len___7 = strlen((char const   *)opt_ptr);   6770             __s1_len___7 = strlen((char const   *)opt_ptr);
6771             __s2_len___7 = strlen("out");   6771             __s2_len___7 = strlen("out");
6772             if (! ((size_t )((void const   *)(opt_ptr + 1)) - (size_t )((void const   *)opt_ptr) == 1U)) {   6772             if (! ((size_t )((void const   *)(opt_ptr + 1)) - (size_t )((void const   *)opt_ptr) == 1U)) {
6773               goto _L___16;   6773               goto _L___16;
6774             } else   6774             } else
6775             if (__s1_len___7 >= 4U) {   6775             if (__s1_len___7 >= 4U) {
6776               _L___16: /* CIL Label */   6776               _L___16: /* CIL Label */
6777               if (! ((size_t )((void const   *)("out" + 1)) - (size_t )((void const   *)"out") == 1U)) {   6777               if (! ((size_t )((void const   *)("out" + 1)) - (size_t )((void const   *)"out") == 1U)) {
6778                 tmp___114 = 1;   6778                 tmp___114 = 1;
6779               } else   6779               } else
6780               if (__s2_len___7 >= 4U) {   6780               if (__s2_len___7 >= 4U) {
6781                 tmp___114 = 1;   6781                 tmp___114 = 1;
6782               } else {   6782               } else {
6783                 tmp___114 = 0;   6783                 tmp___114 = 0;
6784               }   6784               }
6785             } else {   6785             } else {
6786               tmp___114 = 0;   6786               tmp___114 = 0;
6787             }   6787             }
6788             if (tmp___114) {   6788             if (tmp___114) {
6789               tmp___109 = __builtin_strcmp((char const   *)opt_ptr, "out");   6789               tmp___109 = __builtin_strcmp((char const   *)opt_ptr, "out");
6790               tmp___113 = tmp___109;   6790               tmp___113 = tmp___109;
6791             } else {   6791             } else {
6792               tmp___112 = __builtin_strcmp((char const   *)opt_ptr, "out");   6792               tmp___112 = __builtin_strcmp((char const   *)opt_ptr, "out");
6793               tmp___113 = tmp___112;   6793               tmp___113 = tmp___112;
6794             }   6794             }
6795           } else {   6795           } else {
6796             tmp___112 = __builtin_strcmp((char const   *)opt_ptr, "out");   6796             tmp___112 = __builtin_strcmp((char const   *)opt_ptr, "out");
6797             tmp___113 = tmp___112;   6797             tmp___113 = tmp___112;
6798           }   6798           }
6799           tmp___116 = tmp___113;   6799           tmp___116 = tmp___113;
6800         } else {   6800         } else {
6801           tmp___115 = strncmp((char const   *)opt_ptr, "out", (size_t )3);   6801           tmp___115 = strncmp((char const   *)opt_ptr, "out", (size_t )3);
6802           tmp___116 = tmp___115;   6802           tmp___116 = tmp___115;
6803         }   6803         }
6804         if (tmp___116 == 0) {   6804         if (tmp___116 == 0) {
6805           __builtin_strncpy(dump->outfilename, (char const   *)(opt_offset + 1),   6805           __builtin_strncpy(dump->outfilename, (char const   *)(opt_offset + 1),
6806                             4076U);   6806                             4076U);
6807         } else {   6807         } else {
6808     6808  
6809         }   6809         }
6810         if (0) {   6810         if (0) {
6811           if (0) {   6811           if (0) {
6812             __s1_len___8 = strlen((char const   *)opt_ptr);   6812             __s1_len___8 = strlen((char const   *)opt_ptr);
6813             __s2_len___8 = strlen("deb");   6813             __s2_len___8 = strlen("deb");
6814             if (! ((size_t )((void const   *)(opt_ptr + 1)) - (size_t )((void const   *)opt_ptr) == 1U)) {   6814             if (! ((size_t )((void const   *)(opt_ptr + 1)) - (size_t )((void const   *)opt_ptr) == 1U)) {
6815               goto _L___18;   6815               goto _L___18;
6816             } else   6816             } else
6817             if (__s1_len___8 >= 4U) {   6817             if (__s1_len___8 >= 4U) {
6818               _L___18: /* CIL Label */   6818               _L___18: /* CIL Label */
6819               if (! ((size_t )((void const   *)("deb" + 1)) - (size_t )((void const   *)"deb") == 1U)) {   6819               if (! ((size_t )((void const   *)("deb" + 1)) - (size_t )((void const   *)"deb") == 1U)) {
6820                 tmp___127 = 1;   6820                 tmp___127 = 1;
6821               } else   6821               } else
6822               if (__s2_len___8 >= 4U) {   6822               if (__s2_len___8 >= 4U) {
6823                 tmp___127 = 1;   6823                 tmp___127 = 1;
6824               } else {   6824               } else {
6825                 tmp___127 = 0;   6825                 tmp___127 = 0;
6826               }   6826               }
6827             } else {   6827             } else {
6828               tmp___127 = 0;   6828               tmp___127 = 0;
6829             }   6829             }
6830             if (tmp___127) {   6830             if (tmp___127) {
6831               tmp___122 = __builtin_strcmp((char const   *)opt_ptr, "deb");   6831               tmp___122 = __builtin_strcmp((char const   *)opt_ptr, "deb");
6832               tmp___126 = tmp___122;   6832               tmp___126 = tmp___122;
6833             } else {   6833             } else {
6834               tmp___125 = __builtin_strcmp((char const   *)opt_ptr, "deb");   6834               tmp___125 = __builtin_strcmp((char const   *)opt_ptr, "deb");
6835               tmp___126 = tmp___125;   6835               tmp___126 = tmp___125;
6836             }   6836             }
6837           } else {   6837           } else {
6838             tmp___125 = __builtin_strcmp((char const   *)opt_ptr, "deb");   6838             tmp___125 = __builtin_strcmp((char const   *)opt_ptr, "deb");
6839             tmp___126 = tmp___125;   6839             tmp___126 = tmp___125;
6840           }   6840           }
6841           tmp___129 = tmp___126;   6841           tmp___129 = tmp___126;
6842         } else {   6842         } else {
6843           tmp___128 = strncmp((char const   *)opt_ptr, "deb", (size_t )3);   6843           tmp___128 = strncmp((char const   *)opt_ptr, "deb", (size_t )3);
6844           tmp___129 = tmp___128;   6844           tmp___129 = tmp___128;
6845         }   6845         }
6846         if (tmp___129 == 0) {   6846         if (tmp___129 == 0) {
6847           dump->debug = atoi((char const   *)(opt_offset + 1));   6847           dump->debug = atoi((char const   *)(opt_offset + 1));
6848         } else {   6848         } else {
6849     6849  
6850         }   6850         }
6851       }   6851       }
6852       opt_ptr = strtok((char */* __restrict  */)((void *)0),   6852       opt_ptr = strtok((char */* __restrict  */)((void *)0),
6853                        (char const   */* __restrict  */)",");   6853                        (char const   */* __restrict  */)",");
6854       i ++;   6854       i ++;
6855     }   6855     }
6856     tmp___145 = strlen((char const   *)(dump->infilename));   6856     tmp___145 = strlen((char const   *)(dump->infilename));
6857     if (tmp___145) {   6857     if (tmp___145) {
6858       goto _L___21;   6858       goto _L___21;
6859     } else {   6859     } else {
6860       tmp___146 = strlen((char const   *)(dump->outfilename));   6860       tmp___146 = strlen((char const   *)(dump->outfilename));
6861       if (tmp___146) {   6861       if (tmp___146) {
6862         _L___21: /* CIL Label */   6862         _L___21: /* CIL Label */
6863         if (dump->level == 1) {   6863         if (dump->level == 1) {
6864           TIFFError("", "Defaulting to dump level 1, no data.");   6864           TIFFError("", "Defaulting to dump level 1, no data.");
6865         } else {   6865         } else {
6866     6866  
6867         }   6867         }
6868         if (dump->format == 0) {   6868         if (dump->format == 0) {
6869           TIFFError("", "You must specify a dump format for dump files");   6869           TIFFError("", "You must specify a dump format for dump files");
6870           TIFFError("For valid options type", "tiffcrop -h");   6870           TIFFError("For valid options type", "tiffcrop -h");
6871           exit(-1);   6871           exit(-1);
6872         } else {   6872         } else {
6873     6873  
6874         }   6874         }
6875       } else {   6875       } else {
6876     6876  
6877       }   6877       }
6878     }   6878     }
6879     break;   6879     break;
6880     case 109:   6880     case 109:
6881     crop_data->crop_mode = (uint16 )((int )crop_data->crop_mode | 1);   6881     crop_data->crop_mode = (uint16 )((int )crop_data->crop_mode | 1);
6882     i = 0U;   6882     i = 0U;
6883     opt_ptr = strtok((char */* __restrict  */)optarg,   6883     opt_ptr = strtok((char */* __restrict  */)optarg,
6884                      (char const   */* __restrict  */)",:");   6884                      (char const   */* __restrict  */)",:");
6885     while (1) {   6885     while (1) {
6886       if ((unsigned int )opt_ptr != (unsigned int )((void *)0)) {   6886       if ((unsigned int )opt_ptr != (unsigned int )((void *)0)) {
6887         if (i < 4U) {   6887         if (i < 4U) {
6888     6888  
6889         } else {   6889         } else {
6890           break;   6890           break;
6891         }   6891         }
6892       } else {   6892       } else {
6893         break;   6893         break;
6894       }   6894       }
6895       crop_data->margins[i] = atof((char const   *)opt_ptr);   6895       crop_data->margins[i] = atof((char const   *)opt_ptr);
6896       opt_ptr = strtok((char */* __restrict  */)((void *)0),   6896       opt_ptr = strtok((char */* __restrict  */)((void *)0),
6897                        (char const   */* __restrict  */)",:");   6897                        (char const   */* __restrict  */)",:");
6898       i ++;   6898       i ++;
6899     }   6899     }
6900     break;   6900     break;
6901     case 69:   6901     case 69:
6902     if (sizeof(*(optarg + 0)) > 1U) {   6902     if (sizeof(*(optarg + 0)) > 1U) {
6903       __res___2 = tolower((int )*(optarg + 0));   6903       __res___2 = tolower((int )*(optarg + 0));
6904     } else {   6904     } else {
6905       tmp___148 = __ctype_tolower_loc();   6905       tmp___148 = __ctype_tolower_loc();
6906       __res___2 = (int )*(*tmp___148 + (int )*(optarg + 0));   6906       __res___2 = (int )*(*tmp___148 + (int )*(optarg + 0));
6907     }   6907     }
6908     switch (__res___2) {   6908     switch (__res___2) {
6909     case 116:   6909     case 116:
6910     crop_data->edge_ref = (uint16 )1;   6910     crop_data->edge_ref = (uint16 )1;
6911     break;   6911     break;
6912     case 98:   6912     case 98:
6913     crop_data->edge_ref = (uint16 )3;   6913     crop_data->edge_ref = (uint16 )3;
6914     break;   6914     break;
6915     case 108:   6915     case 108:
6916     crop_data->edge_ref = (uint16 )2;   6916     crop_data->edge_ref = (uint16 )2;
6917     break;   6917     break;
6918     case 114:   6918     case 114:
6919     crop_data->edge_ref = (uint16 )4;   6919     crop_data->edge_ref = (uint16 )4;
6920     break;   6920     break;
6921     default:   6921     default:
6922     TIFFError("Edge reference must be top, bottom, left, or right", "%s", optarg);   6922     TIFFError("Edge reference must be top, bottom, left, or right", "%s", optarg);
6923     TIFFError("For valid options type", "tiffcrop -h");   6923     TIFFError("For valid options type", "tiffcrop -h");
6924     exit(-1);   6924     exit(-1);
6925     }   6925     }
6926     break;   6926     break;
6927     case 70:   6927     case 70:
6928     crop_data->crop_mode = (uint16 )((int )crop_data->crop_mode | 64);   6928     crop_data->crop_mode = (uint16 )((int )crop_data->crop_mode | 64);
6929     if (sizeof(*(optarg + 0)) > 1U) {   6929     if (sizeof(*(optarg + 0)) > 1U) {
6930       __res___3 = tolower((int )*(optarg + 0));   6930       __res___3 = tolower((int )*(optarg + 0));
6931     } else {   6931     } else {
6932       tmp___150 = __ctype_tolower_loc();   6932       tmp___150 = __ctype_tolower_loc();
6933       __res___3 = (int )*(*tmp___150 + (int )*(optarg + 0));   6933       __res___3 = (int )*(*tmp___150 + (int )*(optarg + 0));
6934     }   6934     }
6935     switch (__res___3) {   6935     switch (__res___3) {
6936     case 104:   6936     case 104:
6937     crop_data->mirror = (uint16 )1;   6937     crop_data->mirror = (uint16 )1;
6938     break;   6938     break;
6939     case 118:   6939     case 118:
6940     crop_data->mirror = (uint16 )2;   6940     crop_data->mirror = (uint16 )2;
6941     break;   6941     break;
6942     case 98:   6942     case 98:
6943     crop_data->mirror = (uint16 )3;   6943     crop_data->mirror = (uint16 )3;
6944     break;   6944     break;
6945     default:   6945     default:
6946     TIFFError("Flip mode must be horiz, vert, or both", "%s", optarg);   6946     TIFFError("Flip mode must be horiz, vert, or both", "%s", optarg);
6947     TIFFError("For valid options type", "tiffcrop -h");   6947     TIFFError("For valid options type", "tiffcrop -h");
6948     exit(-1);   6948     exit(-1);
6949     }   6949     }
6950     break;   6950     break;
6951     case 72:   6951     case 72:
6952     page->hres = atof((char const   *)optarg);   6952     page->hres = atof((char const   *)optarg);
6953     page->mode |= 1U;   6953     page->mode |= 1U;
6954     break;   6954     break;
6955     case 73:   6955     case 73:
6956     crop_data->crop_mode = (uint16 )((int )crop_data->crop_mode | 128);   6956     crop_data->crop_mode = (uint16 )((int )crop_data->crop_mode | 128);
6957     if (0) {   6957     if (0) {
6958       __s1_len___10 = strlen((char const   *)optarg);   6958       __s1_len___10 = strlen((char const   *)optarg);
6959       __s2_len___10 = strlen("black");   6959       __s2_len___10 = strlen("black");
6960       if (! ((size_t )((void const   *)(optarg + 1)) - (size_t )((void const   *)optarg) == 1U)) {   6960       if (! ((size_t )((void const   *)(optarg + 1)) - (size_t )((void const   *)optarg) == 1U)) {
6961         goto _L___23;   6961         goto _L___23;
6962       } else   6962       } else
6963       if (__s1_len___10 >= 4U) {   6963       if (__s1_len___10 >= 4U) {
6964         _L___23: /* CIL Label */   6964         _L___23: /* CIL Label */
6965         if (! ((size_t )((void const   *)("black" + 1)) - (size_t )((void const   *)"black") == 1U)) {   6965         if (! ((size_t )((void const   *)("black" + 1)) - (size_t )((void const   *)"black") == 1U)) {
6966           tmp___157 = 1;   6966           tmp___157 = 1;
6967         } else   6967         } else
6968         if (__s2_len___10 >= 4U) {   6968         if (__s2_len___10 >= 4U) {
6969           tmp___157 = 1;   6969           tmp___157 = 1;
6970         } else {   6970         } else {
6971           tmp___157 = 0;   6971           tmp___157 = 0;
6972         }   6972         }
6973       } else {   6973       } else {
6974         tmp___157 = 0;   6974         tmp___157 = 0;
6975       }   6975       }
6976       if (tmp___157) {   6976       if (tmp___157) {
6977         tmp___152 = __builtin_strcmp((char const   *)optarg, "black");   6977         tmp___152 = __builtin_strcmp((char const   *)optarg, "black");
6978         tmp___156 = tmp___152;   6978         tmp___156 = tmp___152;
6979       } else {   6979       } else {
6980         tmp___155 = __builtin_strcmp((char const   *)optarg, "black");   6980         tmp___155 = __builtin_strcmp((char const   *)optarg, "black");
6981         tmp___156 = tmp___155;   6981         tmp___156 = tmp___155;
6982       }   6982       }
6983     } else {   6983     } else {
6984       tmp___155 = __builtin_strcmp((char const   *)optarg, "black");   6984       tmp___155 = __builtin_strcmp((char const   *)optarg, "black");
6985       tmp___156 = tmp___155;   6985       tmp___156 = tmp___155;
6986     }   6986     }
6987     if (tmp___156 == 0) {   6987     if (tmp___156 == 0) {
6988       crop_data->photometric = (uint16 )1;   6988       crop_data->photometric = (uint16 )1;
6989       continue;   6989       continue;
6990     } else {   6990     } else {
6991     6991  
6992     }   6992     }
6993     if (0) {   6993     if (0) {
6994       __s1_len___11 = strlen((char const   *)optarg);   6994       __s1_len___11 = strlen((char const   *)optarg);
6995       __s2_len___11 = strlen("white");   6995       __s2_len___11 = strlen("white");
6996       if (! ((size_t )((void const   *)(optarg + 1)) - (size_t )((void const   *)optarg) == 1U)) {   6996       if (! ((size_t )((void const   *)(optarg + 1)) - (size_t )((void const   *)optarg) == 1U)) {
6997         goto _L___25;   6997         goto _L___25;
6998       } else   6998       } else
6999       if (__s1_len___11 >= 4U) {   6999       if (__s1_len___11 >= 4U) {
7000         _L___25: /* CIL Label */   7000         _L___25: /* CIL Label */
7001         if (! ((size_t )((void const   *)("white" + 1)) - (size_t )((void const   *)"white") == 1U)) {   7001         if (! ((size_t )((void const   *)("white" + 1)) - (size_t )((void const   *)"white") == 1U)) {
7002           tmp___164 = 1;   7002           tmp___164 = 1;
7003         } else   7003         } else
7004         if (__s2_len___11 >= 4U) {   7004         if (__s2_len___11 >= 4U) {
7005           tmp___164 = 1;   7005           tmp___164 = 1;
7006         } else {   7006         } else {
7007           tmp___164 = 0;   7007           tmp___164 = 0;
7008         }   7008         }
7009       } else {   7009       } else {
7010         tmp___164 = 0;   7010         tmp___164 = 0;
7011       }   7011       }
7012       if (tmp___164) {   7012       if (tmp___164) {
7013         tmp___159 = __builtin_strcmp((char const   *)optarg, "white");   7013         tmp___159 = __builtin_strcmp((char const   *)optarg, "white");
7014         tmp___163 = tmp___159;   7014         tmp___163 = tmp___159;
7015       } else {   7015       } else {
7016         tmp___162 = __builtin_strcmp((char const   *)optarg, "white");   7016         tmp___162 = __builtin_strcmp((char const   *)optarg, "white");
7017         tmp___163 = tmp___162;   7017         tmp___163 = tmp___162;
7018       }   7018       }
7019     } else {   7019     } else {
7020       tmp___162 = __builtin_strcmp((char const   *)optarg, "white");   7020       tmp___162 = __builtin_strcmp((char const   *)optarg, "white");
7021       tmp___163 = tmp___162;   7021       tmp___163 = tmp___162;
7022     }   7022     }
7023     if (tmp___163 == 0) {   7023     if (tmp___163 == 0) {
7024       crop_data->photometric = (uint16 )0;   7024       crop_data->photometric = (uint16 )0;
7025       continue;   7025       continue;
7026     } else {   7026     } else {
7027     7027  
7028     }   7028     }
7029     if (0) {   7029     if (0) {
7030       __s1_len___12 = strlen((char const   *)optarg);   7030       __s1_len___12 = strlen((char const   *)optarg);
7031       __s2_len___12 = strlen("data");   7031       __s2_len___12 = strlen("data");
7032       if (! ((size_t )((void const   *)(optarg + 1)) - (size_t )((void const   *)optarg) == 1U)) {   7032       if (! ((size_t )((void const   *)(optarg + 1)) - (size_t )((void const   *)optarg) == 1U)) {
7033         goto _L___27;   7033         goto _L___27;
7034       } else   7034       } else
7035       if (__s1_len___12 >= 4U) {   7035       if (__s1_len___12 >= 4U) {
7036         _L___27: /* CIL Label */   7036         _L___27: /* CIL Label */
7037         if (! ((size_t )((void const   *)("data" + 1)) - (size_t )((void const   *)"data") == 1U)) {   7037         if (! ((size_t )((void const   *)("data" + 1)) - (size_t )((void const   *)"data") == 1U)) {
7038           tmp___171 = 1;   7038           tmp___171 = 1;
7039         } else   7039         } else
7040         if (__s2_len___12 >= 4U) {   7040         if (__s2_len___12 >= 4U) {
7041           tmp___171 = 1;   7041           tmp___171 = 1;
7042         } else {   7042         } else {
7043           tmp___171 = 0;   7043           tmp___171 = 0;
7044         }   7044         }
7045       } else {   7045       } else {
7046         tmp___171 = 0;   7046         tmp___171 = 0;
7047       }   7047       }
7048       if (tmp___171) {   7048       if (tmp___171) {
7049         tmp___166 = __builtin_strcmp((char const   *)optarg, "data");   7049         tmp___166 = __builtin_strcmp((char const   *)optarg, "data");
7050         tmp___170 = tmp___166;   7050         tmp___170 = tmp___166;
7051       } else {   7051       } else {
7052         tmp___169 = __builtin_strcmp((char const   *)optarg, "data");   7052         tmp___169 = __builtin_strcmp((char const   *)optarg, "data");
7053         tmp___170 = tmp___169;   7053         tmp___170 = tmp___169;
7054       }   7054       }
7055     } else {   7055     } else {
7056       tmp___169 = __builtin_strcmp((char const   *)optarg, "data");   7056       tmp___169 = __builtin_strcmp((char const   *)optarg, "data");
7057       tmp___170 = tmp___169;   7057       tmp___170 = tmp___169;
7058     }   7058     }
7059     if (tmp___170 == 0) {   7059     if (tmp___170 == 0) {
7060       crop_data->photometric = (uint16 )10;   7060       crop_data->photometric = (uint16 )10;
7061       continue;   7061       continue;
7062     } else {   7062     } else {
7063     7063  
7064     }   7064     }
7065     if (0) {   7065     if (0) {
7066       __s1_len___13 = strlen((char const   *)optarg);   7066       __s1_len___13 = strlen((char const   *)optarg);
7067       __s2_len___13 = strlen("both");   7067       __s2_len___13 = strlen("both");
7068       if (! ((size_t )((void const   *)(optarg + 1)) - (size_t )((void const   *)optarg) == 1U)) {   7068       if (! ((size_t )((void const   *)(optarg + 1)) - (size_t )((void const   *)optarg) == 1U)) {
7069         goto _L___29;   7069         goto _L___29;
7070       } else   7070       } else
7071       if (__s1_len___13 >= 4U) {   7071       if (__s1_len___13 >= 4U) {
7072         _L___29: /* CIL Label */   7072         _L___29: /* CIL Label */
7073         if (! ((size_t )((void const   *)("both" + 1)) - (size_t )((void const   *)"both") == 1U)) {   7073         if (! ((size_t )((void const   *)("both" + 1)) - (size_t )((void const   *)"both") == 1U)) {
7074           tmp___178 = 1;   7074           tmp___178 = 1;
7075         } else   7075         } else
7076         if (__s2_len___13 >= 4U) {   7076         if (__s2_len___13 >= 4U) {
7077           tmp___178 = 1;   7077           tmp___178 = 1;
7078         } else {   7078         } else {
7079           tmp___178 = 0;   7079           tmp___178 = 0;
7080         }   7080         }
7081       } else {   7081       } else {
7082         tmp___178 = 0;   7082         tmp___178 = 0;
7083       }   7083       }
7084       if (tmp___178) {   7084       if (tmp___178) {
7085         tmp___173 = __builtin_strcmp((char const   *)optarg, "both");   7085         tmp___173 = __builtin_strcmp((char const   *)optarg, "both");
7086         tmp___177 = tmp___173;   7086         tmp___177 = tmp___173;
7087       } else {   7087       } else {
7088         tmp___176 = __builtin_strcmp((char const   *)optarg, "both");   7088         tmp___176 = __builtin_strcmp((char const   *)optarg, "both");
7089         tmp___177 = tmp___176;   7089         tmp___177 = tmp___176;
7090       }   7090       }
7091     } else {   7091     } else {
7092       tmp___176 = __builtin_strcmp((char const   *)optarg, "both");   7092       tmp___176 = __builtin_strcmp((char const   *)optarg, "both");
7093       tmp___177 = tmp___176;   7093       tmp___177 = tmp___176;
7094     }   7094     }
7095     if (tmp___177 == 0) {   7095     if (tmp___177 == 0) {
7096       crop_data->photometric = (uint16 )11;   7096       crop_data->photometric = (uint16 )11;
7097       continue;   7097       continue;
7098     } else {   7098     } else {
7099     7099  
7100     }   7100     }
7101     TIFFError("Missing or unknown option for inverting PHOTOMETRIC_INTERPRETATION",   7101     TIFFError("Missing or unknown option for inverting PHOTOMETRIC_INTERPRETATION",
7102               "%s", optarg);   7102               "%s", optarg);
7103     TIFFError("For valid options type", "tiffcrop -h");   7103     TIFFError("For valid options type", "tiffcrop -h");
7104     exit(-1);   7104     exit(-1);
7105     break;   7105     break;
7106     case 74:   7106     case 74:
7107     page->hmargin = atof((char const   *)optarg);   7107     page->hmargin = atof((char const   *)optarg);
7108     page->mode |= 4U;   7108     page->mode |= 4U;
7109     break;   7109     break;
7110     case 75:   7110     case 75:
7111     page->vmargin = atof((char const   *)optarg);   7111     page->vmargin = atof((char const   *)optarg);
7112     page->mode |= 4U;   7112     page->mode |= 4U;
7113     break;   7113     break;
7114     case 78:   7114     case 78:
7115     i = 0U;   7115     i = 0U;
7116     opt_ptr = strtok((char */* __restrict  */)optarg,   7116     opt_ptr = strtok((char */* __restrict  */)optarg,
7117                      (char const   */* __restrict  */)",");   7117                      (char const   */* __restrict  */)",");
7118     while (1) {   7118     while (1) {
7119       if ((unsigned int )opt_ptr != (unsigned int )((void *)0)) {   7119       if ((unsigned int )opt_ptr != (unsigned int )((void *)0)) {
7120         if (i < 1024U) {   7120         if (i < 1024U) {
7121     7121  
7122         } else {   7122         } else {
7123           break;   7123           break;
7124         }   7124         }
7125       } else {   7125       } else {
7126         break;   7126         break;
7127       }   7127       }
7128       if (0) {   7128       if (0) {
7129         __s1_len___17 = strlen((char const   *)opt_ptr);   7129         __s1_len___17 = strlen((char const   *)opt_ptr);
7130         __s2_len___17 = strlen("odd");   7130         __s2_len___17 = strlen("odd");
7131         if (! ((size_t )((void const   *)(opt_ptr + 1)) - (size_t )((void const   *)opt_ptr) == 1U)) {   7131         if (! ((size_t )((void const   *)(opt_ptr + 1)) - (size_t )((void const   *)opt_ptr) == 1U)) {
7132           goto _L___37;   7132           goto _L___37;
7133         } else   7133         } else
7134         if (__s1_len___17 >= 4U) {   7134         if (__s1_len___17 >= 4U) {
7135           _L___37: /* CIL Label */   7135           _L___37: /* CIL Label */
7136           if (! ((size_t )((void const   *)("odd" + 1)) - (size_t )((void const   *)"odd") == 1U)) {   7136           if (! ((size_t )((void const   *)("odd" + 1)) - (size_t )((void const   *)"odd") == 1U)) {
7137             tmp___224 = 1;   7137             tmp___224 = 1;
7138           } else   7138           } else
7139           if (__s2_len___17 >= 4U) {   7139           if (__s2_len___17 >= 4U) {
7140             tmp___224 = 1;   7140             tmp___224 = 1;
7141           } else {   7141           } else {
7142             tmp___224 = 0;   7142             tmp___224 = 0;
7143           }   7143           }
7144         } else {   7144         } else {
7145           tmp___224 = 0;   7145           tmp___224 = 0;
7146         }   7146         }
7147         if (tmp___224) {   7147         if (tmp___224) {
7148           tmp___219 = __builtin_strcmp((char const   *)opt_ptr, "odd");   7148           tmp___219 = __builtin_strcmp((char const   *)opt_ptr, "odd");
7149           tmp___223 = tmp___219;   7149           tmp___223 = tmp___219;
7150         } else {   7150         } else {
7151           tmp___222 = __builtin_strcmp((char const   *)opt_ptr, "odd");   7151           tmp___222 = __builtin_strcmp((char const   *)opt_ptr, "odd");
7152           tmp___223 = tmp___222;   7152           tmp___223 = tmp___222;
7153         }   7153         }
7154       } else {   7154       } else {
7155         tmp___222 = __builtin_strcmp((char const   *)opt_ptr, "odd");   7155         tmp___222 = __builtin_strcmp((char const   *)opt_ptr, "odd");
7156         tmp___223 = tmp___222;   7156         tmp___223 = tmp___222;
7157       }   7157       }
7158       if (tmp___223 == 0) {   7158       if (tmp___223 == 0) {
7159         j = 1U;   7159         j = 1U;
7160         while (j <= 1024U) {   7160         while (j <= 1024U) {
7161           tmp___179 = i;   7161           tmp___179 = i;
7162           i ++;   7162           i ++;
7163           *(imagelist + tmp___179) = j;   7163           *(imagelist + tmp___179) = j;
7164           j += 2U;   7164           j += 2U;
7165         }   7165         }
7166         *image_count = 511U;   7166         *image_count = 511U;
7167         break;   7167         break;
7168       } else {   7168       } else {
7169         if (0) {   7169         if (0) {
7170           __s1_len___16 = strlen((char const   *)opt_ptr);   7170           __s1_len___16 = strlen((char const   *)opt_ptr);
7171           __s2_len___16 = strlen("even");   7171           __s2_len___16 = strlen("even");
7172           if (! ((size_t )((void const   *)(opt_ptr + 1)) - (size_t )((void const   *)opt_ptr) == 1U)) {   7172           if (! ((size_t )((void const   *)(opt_ptr + 1)) - (size_t )((void const   *)opt_ptr) == 1U)) {
7173             goto _L___35;   7173             goto _L___35;
7174           } else   7174           } else
7175           if (__s1_len___16 >= 4U) {   7175           if (__s1_len___16 >= 4U) {
7176             _L___35: /* CIL Label */   7176             _L___35: /* CIL Label */
7177             if (! ((size_t )((void const   *)("even" + 1)) - (size_t )((void const   *)"even") == 1U)) {   7177             if (! ((size_t )((void const   *)("even" + 1)) - (size_t )((void const   *)"even") == 1U)) {
7178               tmp___217 = 1;   7178               tmp___217 = 1;
7179             } else   7179             } else
7180             if (__s2_len___16 >= 4U) {   7180             if (__s2_len___16 >= 4U) {
7181               tmp___217 = 1;   7181               tmp___217 = 1;
7182             } else {   7182             } else {
7183               tmp___217 = 0;   7183               tmp___217 = 0;
7184             }   7184             }
7185           } else {   7185           } else {
7186             tmp___217 = 0;   7186             tmp___217 = 0;
7187           }   7187           }
7188           if (tmp___217) {   7188           if (tmp___217) {
7189             tmp___212 = __builtin_strcmp((char const   *)opt_ptr, "even");   7189             tmp___212 = __builtin_strcmp((char const   *)opt_ptr, "even");
7190             tmp___216 = tmp___212;   7190             tmp___216 = tmp___212;
7191           } else {   7191           } else {
7192             tmp___215 = __builtin_strcmp((char const   *)opt_ptr, "even");   7192             tmp___215 = __builtin_strcmp((char const   *)opt_ptr, "even");
7193             tmp___216 = tmp___215;   7193             tmp___216 = tmp___215;
7194           }   7194           }
7195         } else {   7195         } else {
7196           tmp___215 = __builtin_strcmp((char const   *)opt_ptr, "even");   7196           tmp___215 = __builtin_strcmp((char const   *)opt_ptr, "even");
7197           tmp___216 = tmp___215;   7197           tmp___216 = tmp___215;
7198         }   7198         }
7199         if (tmp___216 == 0) {   7199         if (tmp___216 == 0) {
7200           j = 2U;   7200           j = 2U;
7201           while (j <= 1024U) {   7201           while (j <= 1024U) {
7202             tmp___180 = i;   7202             tmp___180 = i;
7203             i ++;   7203             i ++;
7204             *(imagelist + tmp___180) = j;   7204             *(imagelist + tmp___180) = j;
7205             j += 2U;   7205             j += 2U;
7206           }   7206           }
7207           *image_count = 512U;   7207           *image_count = 512U;
7208           break;   7208           break;
7209         } else {   7209         } else {
7210           if (0) {   7210           if (0) {
7211             __s1_len___15 = strlen((char const   *)opt_ptr);   7211             __s1_len___15 = strlen((char const   *)opt_ptr);
7212             __s2_len___15 = strlen("last");   7212             __s2_len___15 = strlen("last");
7213             if (! ((size_t )((void const   *)(opt_ptr + 1)) - (size_t )((void const   *)opt_ptr) == 1U)) {   7213             if (! ((size_t )((void const   *)(opt_ptr + 1)) - (size_t )((void const   *)opt_ptr) == 1U)) {
7214               goto _L___33;   7214               goto _L___33;
7215             } else   7215             } else
7216             if (__s1_len___15 >= 4U) {   7216             if (__s1_len___15 >= 4U) {
7217               _L___33: /* CIL Label */   7217               _L___33: /* CIL Label */
7218               if (! ((size_t )((void const   *)("last" + 1)) - (size_t )((void const   *)"last") == 1U)) {   7218               if (! ((size_t )((void const   *)("last" + 1)) - (size_t )((void const   *)"last") == 1U)) {
7219                 tmp___210 = 1;   7219                 tmp___210 = 1;
7220               } else   7220               } else
7221               if (__s2_len___15 >= 4U) {   7221               if (__s2_len___15 >= 4U) {
7222                 tmp___210 = 1;   7222                 tmp___210 = 1;
7223               } else {   7223               } else {
7224                 tmp___210 = 0;   7224                 tmp___210 = 0;
7225               }   7225               }
7226             } else {   7226             } else {
7227               tmp___210 = 0;   7227               tmp___210 = 0;
7228             }   7228             }
7229             if (tmp___210) {   7229             if (tmp___210) {
7230               tmp___205 = __builtin_strcmp((char const   *)opt_ptr, "last");   7230               tmp___205 = __builtin_strcmp((char const   *)opt_ptr, "last");
7231               tmp___209 = tmp___205;   7231               tmp___209 = tmp___205;
7232             } else {   7232             } else {
7233               tmp___208 = __builtin_strcmp((char const   *)opt_ptr, "last");   7233               tmp___208 = __builtin_strcmp((char const   *)opt_ptr, "last");
7234               tmp___209 = tmp___208;   7234               tmp___209 = tmp___208;
7235             }   7235             }
7236           } else {   7236           } else {
7237             tmp___208 = __builtin_strcmp((char const   *)opt_ptr, "last");   7237             tmp___208 = __builtin_strcmp((char const   *)opt_ptr, "last");
7238             tmp___209 = tmp___208;   7238             tmp___209 = tmp___208;
7239           }   7239           }
7240           if (tmp___209 == 0) {   7240           if (tmp___209 == 0) {
7241             tmp___181 = i;   7241             tmp___181 = i;
7242             i ++;   7242             i ++;
7243             *(imagelist + tmp___181) = 1024U;   7243             *(imagelist + tmp___181) = 1024U;
7244           } else {   7244           } else {
7245             tmp___191 = __builtin_strpbrk((char const   *)opt_ptr, ":-");   7245             tmp___191 = __builtin_strpbrk((char const   *)opt_ptr, ":-");
7246             sep = tmp___191;   7246             sep = tmp___191;
7247             if (! sep) {   7247             if (! sep) {
7248               tmp___192 = i;   7248               tmp___192 = i;
7249               i ++;   7249               i ++;
7250               tmp___193 = atoi((char const   *)opt_ptr);   7250               tmp___193 = atoi((char const   *)opt_ptr);
7251               *(imagelist + tmp___192) = (unsigned int )(tmp___193 - 1);   7251               *(imagelist + tmp___192) = (unsigned int )(tmp___193 - 1);
7252             } else {   7252             } else {
7253               *sep = (char )'\000';   7253               *sep = (char )'\000';
7254               tmp___194 = atoi((char const   *)opt_ptr);   7254               tmp___194 = atoi((char const   *)opt_ptr);
7255               start = (unsigned int )tmp___194;   7255               start = (unsigned int )tmp___194;
7256               if (0) {   7256               if (0) {
7257                 __s1_len___14 = strlen((char const   *)(sep + 1));   7257                 __s1_len___14 = strlen((char const   *)(sep + 1));
7258                 __s2_len___14 = strlen("last");   7258                 __s2_len___14 = strlen("last");
7259                 if (! ((size_t )((void const   *)((sep + 1) + 1)) - (size_t )((void const   *)(sep + 1)) == 1U)) {   7259                 if (! ((size_t )((void const   *)((sep + 1) + 1)) - (size_t )((void const   *)(sep + 1)) == 1U)) {
7260                   goto _L___31;   7260                   goto _L___31;
7261                 } else   7261                 } else
7262                 if (__s1_len___14 >= 4U) {   7262                 if (__s1_len___14 >= 4U) {
7263                   _L___31: /* CIL Label */   7263                   _L___31: /* CIL Label */
7264                   if (! ((size_t )((void const   *)("last" + 1)) - (size_t )((void const   *)"last") == 1U)) {   7264                   if (! ((size_t )((void const   *)("last" + 1)) - (size_t )((void const   *)"last") == 1U)) {
7265                     tmp___202 = 1;   7265                     tmp___202 = 1;
7266                   } else   7266                   } else
7267                   if (__s2_len___14 >= 4U) {   7267                   if (__s2_len___14 >= 4U) {
7268                     tmp___202 = 1;   7268                     tmp___202 = 1;
7269                   } else {   7269                   } else {
7270                     tmp___202 = 0;   7270                     tmp___202 = 0;
7271                   }   7271                   }
7272                 } else {   7272                 } else {
7273                   tmp___202 = 0;   7273                   tmp___202 = 0;
7274                 }   7274                 }
7275                 if (tmp___202) {   7275                 if (tmp___202) {
7276                   tmp___197 = __builtin_strcmp((char const   *)(sep + 1), "last");   7276                   tmp___197 = __builtin_strcmp((char const   *)(sep + 1), "last");
7277                   tmp___201 = tmp___197;   7277                   tmp___201 = tmp___197;
7278                 } else {   7278                 } else {
7279                   tmp___200 = __builtin_strcmp((char const   *)(sep + 1), "last");   7279                   tmp___200 = __builtin_strcmp((char const   *)(sep + 1), "last");
7280                   tmp___201 = tmp___200;   7280                   tmp___201 = tmp___200;
7281                 }   7281                 }
7282               } else {   7282               } else {
7283                 tmp___200 = __builtin_strcmp((char const   *)(sep + 1), "last");   7283                 tmp___200 = __builtin_strcmp((char const   *)(sep + 1), "last");
7284                 tmp___201 = tmp___200;   7284                 tmp___201 = tmp___200;
7285               }   7285               }
7286               if (tmp___201) {   7286               if (tmp___201) {
7287                 tmp___195 = atoi((char const   *)(sep + 1));   7287                 tmp___195 = atoi((char const   *)(sep + 1));
7288                 end = (unsigned int )tmp___195;   7288                 end = (unsigned int )tmp___195;
7289               } else {   7289               } else {
7290                 end = 1024U;   7290                 end = 1024U;
7291               }   7291               }
7292               j = start;   7292               j = start;
7293               while (1) {   7293               while (1) {
7294                 if (j <= end) {   7294                 if (j <= end) {
7295                   if ((j - start) + i < 1024U) {   7295                   if ((j - start) + i < 1024U) {
7296     7296  
7297                   } else {   7297                   } else {
7298                     break;   7298                     break;
7299                   }   7299                   }
7300                 } else {   7300                 } else {
7301                   break;   7301                   break;
7302                 }   7302                 }
7303                 tmp___203 = i;   7303                 tmp___203 = i;
7304                 i ++;   7304                 i ++;
7305                 *(imagelist + tmp___203) = j - 1U;   7305                 *(imagelist + tmp___203) = j - 1U;
7306                 j ++;   7306                 j ++;
7307               }   7307               }
7308             }   7308             }
7309           }   7309           }
7310         }   7310         }
7311       }   7311       }
7312       opt_ptr = strtok((char */* __restrict  */)((void *)0),   7312       opt_ptr = strtok((char */* __restrict  */)((void *)0),
7313                        (char const   */* __restrict  */)",");   7313                        (char const   */* __restrict  */)",");
7314     }   7314     }
7315     *image_count = i;   7315     *image_count = i;
7316     break;   7316     break;
7317     case 79:   7317     case 79:
7318     if (sizeof(*(optarg + 0)) > 1U) {   7318     if (sizeof(*(optarg + 0)) > 1U) {
7319       __res___4 = tolower((int )*(optarg + 0));   7319       __res___4 = tolower((int )*(optarg + 0));
7320     } else {   7320     } else {
7321       tmp___226 = __ctype_tolower_loc();   7321       tmp___226 = __ctype_tolower_loc();
7322       __res___4 = (int )*(*tmp___226 + (int )*(optarg + 0));   7322       __res___4 = (int )*(*tmp___226 + (int )*(optarg + 0));
7323     }   7323     }
7324     switch (__res___4) {   7324     switch (__res___4) {
7325     case 97:   7325     case 97:
7326     page->orient = 16U;   7326     page->orient = 16U;
7327     break;   7327     break;
7328     case 112:   7328     case 112:
7329     page->orient = 1U;   7329     page->orient = 1U;
7330     break;   7330     break;
7331     case 108:   7331     case 108:
7332     page->orient = 2U;   7332     page->orient = 2U;
7333     break;   7333     break;
7334     default:   7334     default:
7335     TIFFError("Orientation must be portrait, landscape, or auto.", "%s", optarg);   7335     TIFFError("Orientation must be portrait, landscape, or auto.", "%s", optarg);
7336     TIFFError("For valid options type", "tiffcrop -h");   7336     TIFFError("For valid options type", "tiffcrop -h");
7337     exit(-1);   7337     exit(-1);
7338     }   7338     }
7339     break;   7339     break;
7340     case 80:   7340     case 80:
7341     tmp___234 = get_page_geometry(optarg, page);   7341     tmp___234 = get_page_geometry(optarg, page);
7342     if (tmp___234) {   7342     if (tmp___234) {
7343       if (0) {   7343       if (0) {
7344         __s1_len___18 = strlen((char const   *)optarg);   7344         __s1_len___18 = strlen((char const   *)optarg);
7345         __s2_len___18 = strlen("list");   7345         __s2_len___18 = strlen("list");
7346         if (! ((size_t )((void const   *)(optarg + 1)) - (size_t )((void const   *)optarg) == 1U)) {   7346         if (! ((size_t )((void const   *)(optarg + 1)) - (size_t )((void const   *)optarg) == 1U)) {
7347           goto _L___39;   7347           goto _L___39;
7348         } else   7348         } else
7349         if (__s1_len___18 >= 4U) {   7349         if (__s1_len___18 >= 4U) {
7350           _L___39: /* CIL Label */   7350           _L___39: /* CIL Label */
7351           if (! ((size_t )((void const   *)("list" + 1)) - (size_t )((void const   *)"list") == 1U)) {   7351           if (! ((size_t )((void const   *)("list" + 1)) - (size_t )((void const   *)"list") == 1U)) {
7352             tmp___233 = 1;   7352             tmp___233 = 1;
7353           } else   7353           } else
7354           if (__s2_len___18 >= 4U) {   7354           if (__s2_len___18 >= 4U) {
7355             tmp___233 = 1;   7355             tmp___233 = 1;
7356           } else {   7356           } else {
7357             tmp___233 = 0;   7357             tmp___233 = 0;
7358           }   7358           }
7359         } else {   7359         } else {
7360           tmp___233 = 0;   7360           tmp___233 = 0;
7361         }   7361         }
7362         if (tmp___233) {   7362         if (tmp___233) {
7363           tmp___228 = __builtin_strcmp((char const   *)optarg, "list");   7363           tmp___228 = __builtin_strcmp((char const   *)optarg, "list");
7364           tmp___232 = tmp___228;   7364           tmp___232 = tmp___228;
7365         } else {   7365         } else {
7366           tmp___231 = __builtin_strcmp((char const   *)optarg, "list");   7366           tmp___231 = __builtin_strcmp((char const   *)optarg, "list");
7367           tmp___232 = tmp___231;   7367           tmp___232 = tmp___231;
7368         }   7368         }
7369       } else {   7369       } else {
7370         tmp___231 = __builtin_strcmp((char const   *)optarg, "list");   7370         tmp___231 = __builtin_strcmp((char const   *)optarg, "list");
7371         tmp___232 = tmp___231;   7371         tmp___232 = tmp___231;
7372       }   7372       }
7373       if (tmp___232) {   7373       if (tmp___232) {
7374     7374  
7375       } else {   7375       } else {
7376         TIFFError("", "Name            Width   Length (in inches)");   7376         TIFFError("", "Name            Width   Length (in inches)");
7377         i = 0U;   7377         i = 0U;
7378         while (i < 48U) {   7378         while (i < 48U) {
7379           TIFFError("", "%-15.15s %5.2f   %5.2f", PaperTable[i].name,   7379           TIFFError("", "%-15.15s %5.2f   %5.2f", PaperTable[i].name,
7380                     PaperTable[i].width, PaperTable[i].length);   7380                     PaperTable[i].width, PaperTable[i].length);
7381           i ++;   7381           i ++;
7382         }   7382         }
7383         exit(-1);   7383         exit(-1);
7384       }   7384       }
7385       TIFFError("Invalid paper size", "%s", optarg);   7385       TIFFError("Invalid paper size", "%s", optarg);
7386       TIFFError("", "Select one of:");   7386       TIFFError("", "Select one of:");
7387       TIFFError("", "Name            Width   Length (in inches)");   7387       TIFFError("", "Name            Width   Length (in inches)");
7388       i = 0U;   7388       i = 0U;
7389       while (i < 48U) {   7389       while (i < 48U) {
7390         TIFFError("", "%-15.15s %5.2f   %5.2f", PaperTable[i].name,   7390         TIFFError("", "%-15.15s %5.2f   %5.2f", PaperTable[i].name,
7391                   PaperTable[i].width, PaperTable[i].length);   7391                   PaperTable[i].width, PaperTable[i].length);
7392         i ++;   7392         i ++;
7393       }   7393       }
7394       exit(-1);   7394       exit(-1);
7395     } else {   7395     } else {
7396       page->mode |= 2U;   7396       page->mode |= 2U;
7397     }   7397     }
7398     break;   7398     break;
7399     case 82:   7399     case 82:
7400     crop_data->crop_mode = (uint16 )((int )crop_data->crop_mode | 32);   7400     crop_data->crop_mode = (uint16 )((int )crop_data->crop_mode | 32);
7401     tmp___235 = strtoul((char const   */* __restrict  */)optarg,   7401     tmp___235 = strtoul((char const   */* __restrict  */)optarg,
7402                         (char **/* __restrict  */)((void *)0), 0);   7402                         (char **/* __restrict  */)((void *)0), 0);
7403     switch (tmp___235) {   7403     switch (tmp___235) {
7404     case 90UL:   7404     case 90UL:
7405     crop_data->rotation = (uint16 )90;   7405     crop_data->rotation = (uint16 )90;
7406     break;   7406     break;
7407     case 180UL:   7407     case 180UL:
7408     crop_data->rotation = (uint16 )180;   7408     crop_data->rotation = (uint16 )180;
7409     break;   7409     break;
7410     case 270UL:   7410     case 270UL:
7411     crop_data->rotation = (uint16 )270;   7411     crop_data->rotation = (uint16 )270;
7412     break;   7412     break;
7413     default:   7413     default:
7414     TIFFError("Rotation must be 90, 180, or 270 degrees clockwise", "%s", optarg);   7414     TIFFError("Rotation must be 90, 180, or 270 degrees clockwise", "%s", optarg);
7415     TIFFError("For valid options type", "tiffcrop -h");   7415     TIFFError("For valid options type", "tiffcrop -h");
7416     exit(-1);   7416     exit(-1);
7417     }   7417     }
7418     break;   7418     break;
7419     case 83:   7419     case 83:
7420     tmp___245 = __builtin_strpbrk((char const   *)optarg, ",:");   7420     tmp___245 = __builtin_strpbrk((char const   *)optarg, ",:");
7421     sep = tmp___245;   7421     sep = tmp___245;
7422     if (sep) {   7422     if (sep) {
7423       *sep = (char )'\000';   7423       *sep = (char )'\000';
7424       tmp___246 = atoi((char const   *)optarg);   7424       tmp___246 = atoi((char const   *)optarg);
7425       page->cols = (unsigned int )tmp___246;   7425       page->cols = (unsigned int )tmp___246;
7426       tmp___247 = atoi((char const   *)(sep + 1));   7426       tmp___247 = atoi((char const   *)(sep + 1));
7427       page->rows = (unsigned int )tmp___247;   7427       page->rows = (unsigned int )tmp___247;
7428     } else {   7428     } else {
7429       tmp___248 = atoi((char const   *)optarg);   7429       tmp___248 = atoi((char const   *)optarg);
7430       page->cols = (unsigned int )tmp___248;   7430       page->cols = (unsigned int )tmp___248;
7431       tmp___249 = atoi((char const   *)optarg);   7431       tmp___249 = atoi((char const   *)optarg);
7432       page->rows = (unsigned int )tmp___249;   7432       page->rows = (unsigned int )tmp___249;
7433     }   7433     }
7434     if (page->cols * page->rows > 32U) {   7434     if (page->cols * page->rows > 32U) {
7435       TIFFError("Limit for subdivisions, ie rows x columns, exceeded", "%d", 32);   7435       TIFFError("Limit for subdivisions, ie rows x columns, exceeded", "%d", 32);
7436       exit(-1);   7436       exit(-1);
7437     } else {   7437     } else {
7438     7438  
7439     }   7439     }
7440     page->mode |= 8U;   7440     page->mode |= 8U;
7441     break;   7441     break;
7442     case 85:   7442     case 85:
7443     if (0) {   7443     if (0) {
7444       __s1_len___21 = strlen((char const   *)optarg);   7444       __s1_len___21 = strlen((char const   *)optarg);
7445       __s2_len___21 = strlen("in");   7445       __s2_len___21 = strlen("in");
7446       if (! ((size_t )((void const   *)(optarg + 1)) - (size_t )((void const   *)optarg) == 1U)) {   7446       if (! ((size_t )((void const   *)(optarg + 1)) - (size_t )((void const   *)optarg) == 1U)) {
7447         goto _L___45;   7447         goto _L___45;
7448       } else   7448       } else
7449       if (__s1_len___21 >= 4U) {   7449       if (__s1_len___21 >= 4U) {
7450         _L___45: /* CIL Label */   7450         _L___45: /* CIL Label */
7451         if (! ((size_t )((void const   *)("in" + 1)) - (size_t )((void const   *)"in") == 1U)) {   7451         if (! ((size_t )((void const   *)("in" + 1)) - (size_t )((void const   *)"in") == 1U)) {
7452           tmp___270 = 1;   7452           tmp___270 = 1;
7453         } else   7453         } else
7454         if (__s2_len___21 >= 4U) {   7454         if (__s2_len___21 >= 4U) {
7455           tmp___270 = 1;   7455           tmp___270 = 1;
7456         } else {   7456         } else {
7457           tmp___270 = 0;   7457           tmp___270 = 0;
7458         }   7458         }
7459       } else {   7459       } else {
7460         tmp___270 = 0;   7460         tmp___270 = 0;
7461       }   7461       }
7462       if (tmp___270) {   7462       if (tmp___270) {
7463         tmp___265 = __builtin_strcmp((char const   *)optarg, "in");   7463         tmp___265 = __builtin_strcmp((char const   *)optarg, "in");
7464         tmp___269 = tmp___265;   7464         tmp___269 = tmp___265;
7465       } else {   7465       } else {
7466         tmp___268 = __builtin_strcmp((char const   *)optarg, "in");   7466         tmp___268 = __builtin_strcmp((char const   *)optarg, "in");
7467         tmp___269 = tmp___268;   7467         tmp___269 = tmp___268;
7468       }   7468       }
7469     } else {   7469     } else {
7470       tmp___268 = __builtin_strcmp((char const   *)optarg, "in");   7470       tmp___268 = __builtin_strcmp((char const   *)optarg, "in");
7471       tmp___269 = tmp___268;   7471       tmp___269 = tmp___268;
7472     }   7472     }
7473     if (tmp___269 == 0) {   7473     if (tmp___269 == 0) {
7474       crop_data->res_unit = (uint16 )2;   7474       crop_data->res_unit = (uint16 )2;
7475       page->res_unit = (uint16 )2;   7475       page->res_unit = (uint16 )2;
7476     } else {   7476     } else {
7477       if (0) {   7477       if (0) {
7478         __s1_len___20 = strlen((char const   *)optarg);   7478         __s1_len___20 = strlen((char const   *)optarg);
7479         __s2_len___20 = strlen("cm");   7479         __s2_len___20 = strlen("cm");
7480         if (! ((size_t )((void const   *)(optarg + 1)) - (size_t )((void const   *)optarg) == 1U)) {   7480         if (! ((size_t )((void const   *)(optarg + 1)) - (size_t )((void const   *)optarg) == 1U)) {
7481           goto _L___43;   7481           goto _L___43;
7482         } else   7482         } else
7483         if (__s1_len___20 >= 4U) {   7483         if (__s1_len___20 >= 4U) {
7484           _L___43: /* CIL Label */   7484           _L___43: /* CIL Label */
7485           if (! ((size_t )((void const   *)("cm" + 1)) - (size_t )((void const   *)"cm") == 1U)) {   7485           if (! ((size_t )((void const   *)("cm" + 1)) - (size_t )((void const   *)"cm") == 1U)) {
7486             tmp___263 = 1;   7486             tmp___263 = 1;
7487           } else   7487           } else
7488           if (__s2_len___20 >= 4U) {   7488           if (__s2_len___20 >= 4U) {
7489             tmp___263 = 1;   7489             tmp___263 = 1;
7490           } else {   7490           } else {
7491             tmp___263 = 0;   7491             tmp___263 = 0;
7492           }   7492           }
7493         } else {   7493         } else {
7494           tmp___263 = 0;   7494           tmp___263 = 0;
7495         }   7495         }
7496         if (tmp___263) {   7496         if (tmp___263) {
7497           tmp___258 = __builtin_strcmp((char const   *)optarg, "cm");   7497           tmp___258 = __builtin_strcmp((char const   *)optarg, "cm");
7498           tmp___262 = tmp___258;   7498           tmp___262 = tmp___258;
7499         } else {   7499         } else {
7500           tmp___261 = __builtin_strcmp((char const   *)optarg, "cm");   7500           tmp___261 = __builtin_strcmp((char const   *)optarg, "cm");
7501           tmp___262 = tmp___261;   7501           tmp___262 = tmp___261;
7502         }   7502         }
7503       } else {   7503       } else {
7504         tmp___261 = __builtin_strcmp((char const   *)optarg, "cm");   7504         tmp___261 = __builtin_strcmp((char const   *)optarg, "cm");
7505         tmp___262 = tmp___261;   7505         tmp___262 = tmp___261;
7506       }   7506       }
7507       if (tmp___262 == 0) {   7507       if (tmp___262 == 0) {
7508         crop_data->res_unit = (uint16 )3;   7508         crop_data->res_unit = (uint16 )3;
7509         page->res_unit = (uint16 )3;   7509         page->res_unit = (uint16 )3;
7510       } else {   7510       } else {
7511         if (0) {   7511         if (0) {
7512           __s1_len___19 = strlen((char const   *)optarg);   7512           __s1_len___19 = strlen((char const   *)optarg);
7513           __s2_len___19 = strlen("px");   7513           __s2_len___19 = strlen("px");
7514           if (! ((size_t )((void const   *)(optarg + 1)) - (size_t )((void const   *)optarg) == 1U)) {   7514           if (! ((size_t )((void const   *)(optarg + 1)) - (size_t )((void const   *)optarg) == 1U)) {
7515             goto _L___41;   7515             goto _L___41;
7516           } else   7516           } else
7517           if (__s1_len___19 >= 4U) {   7517           if (__s1_len___19 >= 4U) {
7518             _L___41: /* CIL Label */   7518             _L___41: /* CIL Label */
7519             if (! ((size_t )((void const   *)("px" + 1)) - (size_t )((void const   *)"px") == 1U)) {   7519             if (! ((size_t )((void const   *)("px" + 1)) - (size_t )((void const   *)"px") == 1U)) {
7520               tmp___256 = 1;   7520               tmp___256 = 1;
7521             } else   7521             } else
7522             if (__s2_len___19 >= 4U) {   7522             if (__s2_len___19 >= 4U) {
7523               tmp___256 = 1;   7523               tmp___256 = 1;
7524             } else {   7524             } else {
7525               tmp___256 = 0;   7525               tmp___256 = 0;
7526             }   7526             }
7527           } else {   7527           } else {
7528             tmp___256 = 0;   7528             tmp___256 = 0;
7529           }   7529           }
7530           if (tmp___256) {   7530           if (tmp___256) {
7531             tmp___251 = __builtin_strcmp((char const   *)optarg, "px");   7531             tmp___251 = __builtin_strcmp((char const   *)optarg, "px");
7532             tmp___255 = tmp___251;   7532             tmp___255 = tmp___251;
7533           } else {   7533           } else {
7534             tmp___254 = __builtin_strcmp((char const   *)optarg, "px");   7534             tmp___254 = __builtin_strcmp((char const   *)optarg, "px");
7535             tmp___255 = tmp___254;   7535             tmp___255 = tmp___254;
7536           }   7536           }
7537         } else {   7537         } else {
7538           tmp___254 = __builtin_strcmp((char const   *)optarg, "px");   7538           tmp___254 = __builtin_strcmp((char const   *)optarg, "px");
7539           tmp___255 = tmp___254;   7539           tmp___255 = tmp___254;
7540         }   7540         }
7541         if (tmp___255 == 0) {   7541         if (tmp___255 == 0) {
7542           crop_data->res_unit = (uint16 )1;   7542           crop_data->res_unit = (uint16 )1;
7543           page->res_unit = (uint16 )1;   7543           page->res_unit = (uint16 )1;
7544         } else {   7544         } else {
7545           TIFFError("Illegal unit of measure", "%s", optarg);   7545           TIFFError("Illegal unit of measure", "%s", optarg);
7546           TIFFError("For valid options type", "tiffcrop -h");   7546           TIFFError("For valid options type", "tiffcrop -h");
7547           exit(-1);   7547           exit(-1);
7548         }   7548         }
7549       }   7549       }
7550     }   7550     }
7551     break;   7551     break;
7552     case 86:   7552     case 86:
7553     page->vres = atof((char const   *)optarg);   7553     page->vres = atof((char const   *)optarg);
7554     page->mode |= 1U;   7554     page->mode |= 1U;
7555     break;   7555     break;
7556     case 88:   7556     case 88:
7557     crop_data->crop_mode = (uint16 )((int )crop_data->crop_mode | 2);   7557     crop_data->crop_mode = (uint16 )((int )crop_data->crop_mode | 2);
7558     crop_data->width = atof((char const   *)optarg);   7558     crop_data->width = atof((char const   *)optarg);
7559     break;   7559     break;
7560     case 89:   7560     case 89:
7561     crop_data->crop_mode = (uint16 )((int )crop_data->crop_mode | 4);   7561     crop_data->crop_mode = (uint16 )((int )crop_data->crop_mode | 4);
7562     crop_data->length = atof((char const   *)optarg);   7562     crop_data->length = atof((char const   *)optarg);
7563     break;   7563     break;
7564     case 90:   7564     case 90:
7565     crop_data->crop_mode = (uint16 )((int )crop_data->crop_mode | 8);   7565     crop_data->crop_mode = (uint16 )((int )crop_data->crop_mode | 8);
7566     i = 0U;   7566     i = 0U;
7567     opt_ptr = strtok((char */* __restrict  */)optarg,   7567     opt_ptr = strtok((char */* __restrict  */)optarg,
7568                      (char const   */* __restrict  */)",");   7568                      (char const   */* __restrict  */)",");
7569     while (1) {   7569     while (1) {
7570       if ((unsigned int )opt_ptr != (unsigned int )((void *)0)) {   7570       if ((unsigned int )opt_ptr != (unsigned int )((void *)0)) {
7571         if (i < 8U) {   7571         if (i < 8U) {
7572     7572  
7573         } else {   7573         } else {
7574           break;   7574           break;
7575         }   7575         }
7576       } else {   7576       } else {
7577         break;   7577         break;
7578       }   7578       }
7579       crop_data->zones = (uint16 )((int )crop_data->zones + 1);   7579       crop_data->zones = (uint16 )((int )crop_data->zones + 1);
7580       tmp___272 = __builtin_strchr(opt_ptr, ':');   7580       tmp___272 = __builtin_strchr(opt_ptr, ':');
7581       opt_offset = tmp___272;   7581       opt_offset = tmp___272;
7582       *opt_offset = (char )'\000';   7582       *opt_offset = (char )'\000';
7583       crop_data->zonelist[i].position = atoi((char const   *)opt_ptr);   7583       crop_data->zonelist[i].position = atoi((char const   *)opt_ptr);
7584       crop_data->zonelist[i].total = atoi((char const   *)(opt_offset + 1));   7584       crop_data->zonelist[i].total = atoi((char const   *)(opt_offset + 1));
7585       opt_ptr = strtok((char */* __restrict  */)((void *)0),   7585       opt_ptr = strtok((char */* __restrict  */)((void *)0),
7586                        (char const   */* __restrict  */)",");   7586                        (char const   */* __restrict  */)",");
7587       i ++;   7587       i ++;
7588     }   7588     }
7589     if ((unsigned int )opt_ptr != (unsigned int )((void *)0)) {   7589     if ((unsigned int )opt_ptr != (unsigned int )((void *)0)) {
7590       if (i >= 8U) {   7590       if (i >= 8U) {
7591         TIFFError("Zone list exceeds region limit", "%d", 8);   7591         TIFFError("Zone list exceeds region limit", "%d", 8);
7592         exit(-1);   7592         exit(-1);
7593       } else {   7593       } else {
7594     7594  
7595       }   7595       }
7596     } else {   7596     } else {
7597     7597  
7598     }   7598     }
7599     break;   7599     break;
7600     case 63:   7600     case 63:
7601     TIFFError("For valid options type", "tiffcrop -h");   7601     TIFFError("For valid options type", "tiffcrop -h");
7602     exit(-1);   7602     exit(-1);
7603     }   7603     }
7604   }   7604   }
7605   return;   7605   return;
7606 }   7606 }
7607 }   7607 }
7608 static int update_output_file(TIFF **tiffout , char *mode , int autoindex ,   7608 static int update_output_file(TIFF **tiffout , char *mode , int autoindex ,
7609                               char *outname , unsigned int *page ) ;   7609                               char *outname , unsigned int *page ) ;
7610 static int findex  =    0;   7610 static int findex  =    0;
7611 static int update_output_file(TIFF **tiffout , char *mode , int autoindex ,   7611 static int update_output_file(TIFF **tiffout , char *mode , int autoindex ,
7612                               char *outname , unsigned int *page )   7612                               char *outname , unsigned int *page )
7613 {   7613 {
7614   char *sep ;   7614   char *sep ;
7615   char filenum[16] ;   7615   char filenum[16] ;
7616   char export_ext[16] ;   7616   char export_ext[16] ;
7617   char exportname[4096] ;   7617   char exportname[4096] ;
7618     7618  
7619   {   7619   {
7620   strcpy((char */* __restrict  */)(export_ext),   7620   strcpy((char */* __restrict  */)(export_ext),
7621          (char const   */* __restrict  */)".tiff");   7621          (char const   */* __restrict  */)".tiff");
7622   if (autoindex) {   7622   if (autoindex) {
7623     if ((unsigned int )*tiffout != (unsigned int )((void *)0)) {   7623     if ((unsigned int )*tiffout != (unsigned int )((void *)0)) {
7624       TIFFClose(*tiffout);   7624       TIFFClose(*tiffout);
7625       *tiffout = (TIFF *)((void *)0);   7625       *tiffout = (TIFF *)((void *)0);
7626     } else {   7626     } else {
7627     7627  
7628     }   7628     }
7629   } else {   7629   } else {
7630     7630  
7631   }   7631   }
7632   __builtin_strncpy(exportname, (char const   *)outname, 4081U);   7632   __builtin_strncpy(exportname, (char const   *)outname, 4081U);
7633   if ((unsigned int )*tiffout == (unsigned int )((void *)0)) {   7633   if ((unsigned int )*tiffout == (unsigned int )((void *)0)) {
7634     if (autoindex) {   7634     if (autoindex) {
7635       findex ++;   7635       findex ++;
7636       sep = strstr((char const   *)(exportname), ".tif");   7636       sep = strstr((char const   *)(exportname), ".tif");
7637       if (sep) {   7637       if (sep) {
7638         __builtin_strncpy(export_ext, (char const   *)sep, 5U);   7638         __builtin_strncpy(export_ext, (char const   *)sep, 5U);
7639         *sep = (char )'\000';   7639         *sep = (char )'\000';
7640       } else {   7640       } else {
7641         sep = strstr((char const   *)(exportname), ".TIF");   7641         sep = strstr((char const   *)(exportname), ".TIF");
7642         if (sep) {   7642         if (sep) {
7643           __builtin_strncpy(export_ext, (char const   *)sep, 5U);   7643           __builtin_strncpy(export_ext, (char const   *)sep, 5U);
7644           *sep = (char )'\000';   7644           *sep = (char )'\000';
7645         } else {   7645         } else {
7646           __builtin_strncpy(export_ext, ".tiff", 5U);   7646           __builtin_strncpy(export_ext, ".tiff", 5U);
7647         }   7647         }
7648       }   7648       }
7649       export_ext[5] = (char )'\000';   7649       export_ext[5] = (char )'\000';
7650       sprintf((char */* __restrict  */)(filenum),   7650       sprintf((char */* __restrict  */)(filenum),
7651               (char const   */* __restrict  */)"-%03d%s", findex, export_ext);   7651               (char const   */* __restrict  */)"-%03d%s", findex, export_ext);
7652       filenum[15] = (char )'\000';   7652       filenum[15] = (char )'\000';
7653       __builtin_strncat(exportname, (char const   *)(filenum), 14U);   7653       __builtin_strncat(exportname, (char const   *)(filenum), 14U);
7654     } else {   7654     } else {
7655     7655  
7656     }   7656     }
7657     *tiffout = TIFFOpen((char const   *)(exportname), (char const   *)mode);   7657     *tiffout = TIFFOpen((char const   *)(exportname), (char const   *)mode);
7658     if ((unsigned int )*tiffout == (unsigned int )((void *)0)) {   7658     if ((unsigned int )*tiffout == (unsigned int )((void *)0)) {
7659       TIFFError("update_output_file", "Unable to open output file %s\n",   7659       TIFFError("update_output_file", "Unable to open output file %s\n",
7660                 exportname);   7660                 exportname);
7661       return (1);   7661       return (1);
7662     } else {   7662     } else {
7663     7663  
7664     }   7664     }
7665     *page = 0U;   7665     *page = 0U;
7666     return (0);   7666     return (0);
7667   } else {   7667   } else {
7668     (*page) ++;   7668     (*page) ++;
7669   }   7669   }
7670   return (0);   7670   return (0);
7671 }   7671 }
7672 }   7672 }
7673 int main(int argc , char **argv )   7673 int main(int argc , char **argv )
7674 {   7674 {
7675   uint16 defconfig ;   7675   uint16 defconfig ;
7676   uint16 deffillorder ;   7676   uint16 deffillorder ;
7677   uint32 deftilewidth ;   7677   uint32 deftilewidth ;
7678   uint32 deftilelength ;   7678   uint32 deftilelength ;
7679   uint32 defrowsperstrip ;   7679   uint32 defrowsperstrip ;
7680   uint32 dirnum ;   7680   uint32 dirnum ;
7681   TIFF *in ;   7681   TIFF *in ;
7682   TIFF *out ;   7682   TIFF *out ;
7683   char mode[10] ;   7683   char mode[10] ;
7684   char *mp ;   7684   char *mp ;
7685   struct image_data image ;   7685   struct image_data image ;
7686   struct crop_mask crop ;   7686   struct crop_mask crop ;
7687   struct pagedef page ;   7687   struct pagedef page ;
7688   struct pageseg sections[32] ;   7688   struct pageseg sections[32] ;
7689   struct buffinfo seg_buffs[32] ;   7689   struct buffinfo seg_buffs[32] ;
7690   struct dump_opts dump ;   7690   struct dump_opts dump ;
7691   unsigned char *read_buff ;   7691   unsigned char *read_buff ;
7692   unsigned char *crop_buff ;   7692   unsigned char *crop_buff ;
7693   unsigned char *sect_buff ;   7693   unsigned char *sect_buff ;
7694   unsigned char *sect_src ;   7694   unsigned char *sect_src ;
7695   unsigned int imagelist[1025] ;   7695   unsigned int imagelist[1025] ;
7696   unsigned int image_count ;   7696   unsigned int image_count ;
7697   unsigned int dump_images ;   7697   unsigned int dump_images ;
7698   unsigned int next_image ;   7698   unsigned int next_image ;
7699   unsigned int next_page ;   7699   unsigned int next_page ;
7700   unsigned int total_pages ;   7700   unsigned int total_pages ;
7701   unsigned int total_images ;   7701   unsigned int total_images ;
7702   unsigned int end_of_input ;   7702   unsigned int end_of_input ;
7703   int seg ;   7703   int seg ;
7704   int length ;   7704   int length ;
7705   char temp_filename[4097] ;   7705   char temp_filename[4097] ;
7706   uint16 tmp ;   7706   uint16 tmp ;
7707   char const   *tmp___0 ;   7707   char const   *tmp___0 ;
7708   char const   *tmp___1 ;   7708   char const   *tmp___1 ;
7709   int tmp___2 ;   7709   int tmp___2 ;
7710   size_t tmp___3 ;   7710   size_t tmp___3 ;
7711   char const   *tmp___4 ;   7711   char const   *tmp___4 ;
7712   char const   *tmp___5 ;   7712   char const   *tmp___5 ;
7713   size_t tmp___6 ;   7713   size_t tmp___6 ;
7714   char const   *tmp___7 ;   7714   char const   *tmp___7 ;
7715   char const   *tmp___8 ;   7715   char const   *tmp___8 ;
7716   int tmp___9 ;   7716   int tmp___9 ;
7717   int tmp___10 ;   7717   int tmp___10 ;
7718   int tmp___11 ;   7718   int tmp___11 ;
7719   int tmp___12 ;   7719   int tmp___12 ;
7720   int tmp___13 ;   7720   int tmp___13 ;
7721   int tmp___14 ;   7721   int tmp___14 ;
7722   int tmp___15 ;   7722   int tmp___15 ;
7723   int tmp___16 ;   7723   int tmp___16 ;
7724   int tmp___17 ;   7724   int tmp___17 ;
7725   int tmp___18 ;   7725   int tmp___18 ;
7726   uint16 tmp___19 ;   7726   uint16 tmp___19 ;
7727   int tmp___20 ;   7727   int tmp___20 ;
7728   char const   *tmp___21 ;   7728   char const   *tmp___21 ;
7729     7729  
7730   {   7730   {
7731   defconfig = (uint16 )-1;   7731   defconfig = (uint16 )-1;
7732   deffillorder = (uint16 )0;   7732   deffillorder = (uint16 )0;
7733   deftilewidth = (uint32 )-1;   7733   deftilewidth = (uint32 )-1;
7734   deftilelength = (uint32 )-1;   7734   deftilelength = (uint32 )-1;
7735   defrowsperstrip = (uint32 )0;   7735   defrowsperstrip = (uint32 )0;
7736   dirnum = (uint32 )0;   7736   dirnum = (uint32 )0;
7737   in = (TIFF *)((void *)0);   7737   in = (TIFF *)((void *)0);
7738   out = (TIFF *)((void *)0);   7738   out = (TIFF *)((void *)0);
7739   mp = mode;   7739   mp = mode;
7740   read_buff = (unsigned char *)((void *)0);   7740   read_buff = (unsigned char *)((void *)0);
7741   crop_buff = (unsigned char *)((void *)0);   7741   crop_buff = (unsigned char *)((void *)0);
7742   sect_buff = (unsigned char *)((void *)0);   7742   sect_buff = (unsigned char *)((void *)0);
7743   sect_src = (unsigned char *)((void *)0);   7743   sect_src = (unsigned char *)((void *)0);
7744   image_count = 0U;   7744   image_count = 0U;
7745   dump_images = 0U;   7745   dump_images = 0U;
7746   next_image = 0U;   7746   next_image = 0U;
7747   next_page = 0U;   7747   next_page = 0U;
7748   total_pages = 0U;   7748   total_pages = 0U;
7749   total_images = 0U;   7749   total_images = 0U;
7750   end_of_input = 0U;   7750   end_of_input = 0U;
7751   memset((void *)(temp_filename), '\000', (size_t )4097);   7751   memset((void *)(temp_filename), '\000', (size_t )4097);
7752   little_endian = (int )*((unsigned char *)(& little_endian)) & 49;   7752   little_endian = (int )*((unsigned char *)(& little_endian)) & 49;
7753   initImageData(& image);   7753   initImageData(& image);
7754   initCropMasks(& crop);   7754   initCropMasks(& crop);
7755   initPageSetup(& page, sections, seg_buffs);   7755   initPageSetup(& page, sections, seg_buffs);
7756   initDumpOptions(& dump);   7756   initDumpOptions(& dump);
7757   process_command_opts(argc, argv, mp, mode, & dirnum, & defconfig,   7757   process_command_opts(argc, argv, mp, mode, & dirnum, & defconfig,
7758                        & deffillorder, & deftilewidth, & deftilelength,   7758                        & deffillorder, & deftilewidth, & deftilelength,
7759                        & defrowsperstrip, & crop, & page, & dump, imagelist,   7759                        & defrowsperstrip, & crop, & page, & dump, imagelist,
7760                        & image_count);   7760                        & image_count);
7761   if (argc - optind < 2) {   7761   if (argc - optind < 2) {
7762     usage();   7762     usage();
7763   } else {   7763   } else {
7764     7764  
7765   }   7765   }
7766   if (argc - optind == 2) {   7766   if (argc - optind == 2) {
7767     pageNum = -1;   7767     pageNum = -1;
7768   } else {   7768   } else {
7769     total_images = 0U;   7769     total_images = 0U;
7770   }   7770   }
7771   while (optind < argc - 1) {   7771   while (optind < argc - 1) {
7772     in = TIFFOpen((char const   *)*(argv + optind), "r");   7772     in = TIFFOpen((char const   *)*(argv + optind), "r");
7773     if ((unsigned int )in == (unsigned int )((void *)0)) {   7773     if ((unsigned int )in == (unsigned int )((void *)0)) {
7774       return (-3);   7774       return (-3);
7775     } else {   7775     } else {
7776     7776  
7777     }   7777     }
7778     tmp = TIFFNumberOfDirectories(in);   7778     tmp = TIFFNumberOfDirectories(in);
7779     total_images = (unsigned int )tmp;   7779     total_images = (unsigned int )tmp;
7780     if (image_count == 0U) {   7780     if (image_count == 0U) {
7781       dirnum = (uint32 )0;   7781       dirnum = (uint32 )0;
7782       total_pages = total_images;   7782       total_pages = total_images;
7783     } else {   7783     } else {
7784       dirnum = (uint32 )((tdir_t )(imagelist[next_image] - 1U));   7784       dirnum = (uint32 )((tdir_t )(imagelist[next_image] - 1U));
7785       next_image ++;   7785       next_image ++;
7786       if (image_count > total_images) {   7786       if (image_count > total_images) {
7787         image_count = total_images;   7787         image_count = total_images;
7788       } else {   7788       } else {
7789     7789  
7790       }   7790       }
7791       total_pages = image_count;   7791       total_pages = image_count;
7792     }   7792     }
7793     if (dirnum == 1023U) {   7793     if (dirnum == 1023U) {
7794       dirnum = total_images - 1U;   7794       dirnum = total_images - 1U;
7795     } else {   7795     } else {
7796     7796  
7797     }   7797     }
7798     if (dirnum > total_images) {   7798     if (dirnum > total_images) {
7799       tmp___0 = TIFFFileName(in);   7799       tmp___0 = TIFFFileName(in);
7800       TIFFError(tmp___0,   7800       TIFFError(tmp___0,
7801                 "Invalid image number %d, File contains only %d images",   7801                 "Invalid image number %d, File contains only %d images",
7802                 (int )dirnum + 1, total_images);   7802                 (int )dirnum + 1, total_images);
7803       if ((unsigned int )out != (unsigned int )((void *)0)) {   7803       if ((unsigned int )out != (unsigned int )((void *)0)) {
7804         TIFFClose(out);   7804         TIFFClose(out);
7805       } else {   7805       } else {
7806     7806  
7807       }   7807       }
7808       return (1);   7808       return (1);
7809     } else {   7809     } else {
7810     7810  
7811     }   7811     }
7812     if (dirnum != 0U) {   7812     if (dirnum != 0U) {
7813       tmp___2 = TIFFSetDirectory(in, (tdir_t )dirnum);   7813       tmp___2 = TIFFSetDirectory(in, (tdir_t )dirnum);
7814       if (tmp___2) {   7814       if (tmp___2) {
7815     7815  
7816       } else {   7816       } else {
7817         tmp___1 = TIFFFileName(in);   7817         tmp___1 = TIFFFileName(in);
7818         TIFFError(tmp___1, "Error, setting subdirectory at %d", dirnum);   7818         TIFFError(tmp___1, "Error, setting subdirectory at %d", dirnum);
7819         if ((unsigned int )out != (unsigned int )((void *)0)) {   7819         if ((unsigned int )out != (unsigned int )((void *)0)) {
7820           TIFFClose(out);   7820           TIFFClose(out);
7821         } else {   7821         } else {
7822     7822  
7823         }   7823         }
7824         return (1);   7824         return (1);
7825       }   7825       }
7826     } else {   7826     } else {
7827     7827  
7828     }   7828     }
7829     end_of_input = 0U;   7829     end_of_input = 0U;
7830     while (end_of_input == 0U) {   7830     while (end_of_input == 0U) {
7831       config = defconfig;   7831       config = defconfig;
7832       compression = defcompression;   7832       compression = defcompression;
7833       predictor = defpredictor;   7833       predictor = defpredictor;
7834       fillorder = deffillorder;   7834       fillorder = deffillorder;
7835       rowsperstrip = defrowsperstrip;   7835       rowsperstrip = defrowsperstrip;
7836       tilewidth = deftilewidth;   7836       tilewidth = deftilewidth;
7837       tilelength = deftilelength;   7837       tilelength = deftilelength;
7838       g3opts = defg3opts;   7838       g3opts = defg3opts;
7839       if (dump.format != 0) {   7839       if (dump.format != 0) {
7840         dump_images ++;   7840         dump_images ++;
7841         tmp___3 = strlen((char const   *)(dump.infilename));   7841         tmp___3 = strlen((char const   *)(dump.infilename));
7842         length = (int )tmp___3;   7842         length = (int )tmp___3;
7843         if (length > 0) {   7843         if (length > 0) {
7844           if ((unsigned int )dump.infile != (unsigned int )((void *)0)) {   7844           if ((unsigned int )dump.infile != (unsigned int )((void *)0)) {
7845             fclose(dump.infile);   7845             fclose(dump.infile);
7846           } else {   7846           } else {
7847     7847  
7848           }   7848           }
7849           if (dump.format == 1) {   7849           if (dump.format == 1) {
7850             tmp___4 = "txt";   7850             tmp___4 = "txt";
7851           } else {   7851           } else {
7852             tmp___4 = "raw";   7852             tmp___4 = "raw";
7853           }   7853           }
7854           sprintf((char */* __restrict  */)(temp_filename),   7854           sprintf((char */* __restrict  */)(temp_filename),
7855                   (char const   */* __restrict  */)"%s-read-%03d.%s",   7855                   (char const   */* __restrict  */)"%s-read-%03d.%s",
7856                   dump.infilename, dump_images, tmp___4);   7856                   dump.infilename, dump_images, tmp___4);
7857           dump.infile = fopen((char const   */* __restrict  */)(temp_filename),   7857           dump.infile = fopen((char const   */* __restrict  */)(temp_filename),
7858                               (char const   */* __restrict  */)(dump.mode));   7858                               (char const   */* __restrict  */)(dump.mode));
7859           if ((unsigned int )dump.infile == (unsigned int )((void *)0)) {   7859           if ((unsigned int )dump.infile == (unsigned int )((void *)0)) {
7860             TIFFError("Unable to open dump file %s for writing",   7860             TIFFError("Unable to open dump file %s for writing",
7861                       (char const   *)(temp_filename));   7861                       (char const   *)(temp_filename));
7862             exit(-1);   7862             exit(-1);
7863           } else {   7863           } else {
7864     7864  
7865           }   7865           }
7866           tmp___5 = TIFFFileName(in);   7866           tmp___5 = TIFFFileName(in);
7867           dump_info(dump.infile, dump.format, (char *)"Reading image",   7867           dump_info(dump.infile, dump.format, (char *)"Reading image",
7868                     (char *)"%d from %s", dump_images, tmp___5);   7868                     (char *)"%d from %s", dump_images, tmp___5);
7869         } else {   7869         } else {
7870     7870  
7871         }   7871         }
7872         tmp___6 = strlen((char const   *)(dump.outfilename));   7872         tmp___6 = strlen((char const   *)(dump.outfilename));
7873         length = (int )tmp___6;   7873         length = (int )tmp___6;
7874         if (length > 0) {   7874         if (length > 0) {
7875           if ((unsigned int )dump.outfile != (unsigned int )((void *)0)) {   7875           if ((unsigned int )dump.outfile != (unsigned int )((void *)0)) {
7876             fclose(dump.outfile);   7876             fclose(dump.outfile);
7877           } else {   7877           } else {
7878     7878  
7879           }   7879           }
7880           if (dump.format == 1) {   7880           if (dump.format == 1) {
7881             tmp___7 = "txt";   7881             tmp___7 = "txt";
7882           } else {   7882           } else {
7883             tmp___7 = "raw";   7883             tmp___7 = "raw";
7884           }   7884           }
7885           sprintf((char */* __restrict  */)(temp_filename),   7885           sprintf((char */* __restrict  */)(temp_filename),
7886                   (char const   */* __restrict  */)"%s-write-%03d.%s",   7886                   (char const   */* __restrict  */)"%s-write-%03d.%s",
7887                   dump.outfilename, dump_images, tmp___7);   7887                   dump.outfilename, dump_images, tmp___7);
7888           dump.outfile = fopen((char const   */* __restrict  */)(temp_filename),   7888           dump.outfile = fopen((char const   */* __restrict  */)(temp_filename),
7889                                (char const   */* __restrict  */)(dump.mode));   7889                                (char const   */* __restrict  */)(dump.mode));
7890           if ((unsigned int )dump.outfile == (unsigned int )((void *)0)) {   7890           if ((unsigned int )dump.outfile == (unsigned int )((void *)0)) {
7891             TIFFError("Unable to open dump file %s for writing",   7891             TIFFError("Unable to open dump file %s for writing",
7892                       (char const   *)(temp_filename));   7892                       (char const   *)(temp_filename));
7893             exit(-1);   7893             exit(-1);
7894           } else {   7894           } else {
7895     7895  
7896           }   7896           }
7897           tmp___8 = TIFFFileName(in);   7897           tmp___8 = TIFFFileName(in);
7898           dump_info(dump.outfile, dump.format, (char *)"Writing image",   7898           dump_info(dump.outfile, dump.format, (char *)"Writing image",
7899                     (char *)"%d from %s", dump_images, tmp___8);   7899                     (char *)"%d from %s", dump_images, tmp___8);
7900         } else {   7900         } else {
7901     7901  
7902         }   7902         }
7903       } else {   7903       } else {
7904     7904  
7905       }   7905       }
7906       if (dump.debug) {   7906       if (dump.debug) {
7907         TIFFError("main", "Reading image %4d of %4d total pages.", dirnum + 1U,   7907         TIFFError("main", "Reading image %4d of %4d total pages.", dirnum + 1U,
7908                   total_pages);   7908                   total_pages);
7909       } else {   7909       } else {
7910     7910  
7911       }   7911       }
7912       tmp___9 = loadImage(in, & image, & dump, & read_buff);   7912       tmp___9 = loadImage(in, & image, & dump, & read_buff);
7913       if (tmp___9) {   7913       if (tmp___9) {
7914         TIFFError("main", "Unable to load source image");   7914         TIFFError("main", "Unable to load source image");
7915         exit(-1);   7915         exit(-1);
7916       } else {   7916       } else {
7917     7917  
7918       }   7918       }
7919       if ((int )image.adjustments != 0) {   7919       if ((int )image.adjustments != 0) {
7920         tmp___10 = correct_orientation(& image, & read_buff);   7920         tmp___10 = correct_orientation(& image, & read_buff);
7921         if (tmp___10) {   7921         if (tmp___10) {
7922           TIFFError("main", "Unable to correct image orientation");   7922           TIFFError("main", "Unable to correct image orientation");
7923         } else {   7923         } else {
7924     7924  
7925         }   7925         }
7926       } else {   7926       } else {
7927     7927  
7928       }   7928       }
7929       tmp___11 = getCropOffsets(& image, & crop, & dump);   7929       tmp___11 = getCropOffsets(& image, & crop, & dump);
7930       if (tmp___11) {   7930       if (tmp___11) {
7931         TIFFError("main", "Unable to define crop regions");   7931         TIFFError("main", "Unable to define crop regions");
7932         exit(-1);   7932         exit(-1);
7933       } else {   7933       } else {
7934     7934  
7935       }   7935       }
7936       if ((int )crop.selections > 0) {   7936       if ((int )crop.selections > 0) {
7937         tmp___12 = processCropSelections(& image, & crop, & read_buff, seg_buffs);   7937         tmp___12 = processCropSelections(& image, & crop, & read_buff, seg_buffs);
7938         if (tmp___12) {   7938         if (tmp___12) {
7939           TIFFError("main", "Unable to process image selections");   7939           TIFFError("main", "Unable to process image selections");
7940           exit(-1);   7940           exit(-1);
7941         } else {   7941         } else {
7942     7942  
7943         }   7943         }
7944       } else {   7944       } else {
7945         tmp___13 = createCroppedImage(& image, & crop, & read_buff, & crop_buff);   7945         tmp___13 = createCroppedImage(& image, & crop, & read_buff, & crop_buff);
7946         if (tmp___13) {   7946         if (tmp___13) {
7947           TIFFError("main", "Unable to create output image");   7947           TIFFError("main", "Unable to create output image");
7948           exit(-1);   7948           exit(-1);
7949         } else {   7949         } else {
7950     7950  
7951         }   7951         }
7952       }   7952       }
7953       if (page.mode == 0U) {   7953       if (page.mode == 0U) {
7954         if ((int )crop.selections > 0) {   7954         if ((int )crop.selections > 0) {
7955           writeSelections(in, & out, & crop, & image, & dump, seg_buffs, mp,   7955           writeSelections(in, & out, & crop, & image, & dump, seg_buffs, mp,
7956                           *(argv + (argc - 1)), & next_page, total_pages);   7956                           *(argv + (argc - 1)), & next_page, total_pages);
7957         } else {   7957         } else {
7958           tmp___14 = update_output_file(& out, mp, (int )crop.exp_mode,   7958           tmp___14 = update_output_file(& out, mp, (int )crop.exp_mode,
7959                                         *(argv + (argc - 1)), & next_page);   7959                                         *(argv + (argc - 1)), & next_page);
7960           if (tmp___14) {   7960           if (tmp___14) {
7961             exit(1);   7961             exit(1);
7962           } else {   7962           } else {
7963     7963  
7964           }   7964           }
7965           tmp___15 = writeCroppedImage(in, out, & image, & dump,   7965           tmp___15 = writeCroppedImage(in, out, & image, & dump,
7966                                        crop.combined_width,   7966                                        crop.combined_width,
7967                                        crop.combined_length, crop_buff,   7967                                        crop.combined_length, crop_buff,
7968                                        (int )next_page, (int )total_pages);   7968                                        (int )next_page, (int )total_pages);
7969           if (tmp___15) {   7969           if (tmp___15) {
7970             TIFFError("main", "Unable to write new image");   7970             TIFFError("main", "Unable to write new image");
7971             exit(-1);   7971             exit(-1);
7972           } else {   7972           } else {
7973     7973  
7974           }   7974           }
7975         }   7975         }
7976       } else {   7976       } else {
7977         if ((unsigned int )crop_buff != (unsigned int )((void *)0)) {   7977         if ((unsigned int )crop_buff != (unsigned int )((void *)0)) {
7978           sect_src = crop_buff;   7978           sect_src = crop_buff;
7979         } else {   7979         } else {
7980           sect_src = read_buff;   7980           sect_src = read_buff;
7981         }   7981         }
7982         tmp___16 = computeOutputPixelOffsets(& crop, & image, & page, sections,   7982         tmp___16 = computeOutputPixelOffsets(& crop, & image, & page, sections,
7983                                              & dump);   7983                                              & dump);
7984         if (tmp___16) {   7984         if (tmp___16) {
7985           TIFFError("main", "Unable to compute output section data");   7985           TIFFError("main", "Unable to compute output section data");
7986           exit(-1);   7986           exit(-1);
7987         } else {   7987         } else {
7988     7988  
7989         }   7989         }
7990         tmp___17 = update_output_file(& out, mp, (int )crop.exp_mode,   7990         tmp___17 = update_output_file(& out, mp, (int )crop.exp_mode,
7991                                       *(argv + (argc - 1)), & next_page);   7991                                       *(argv + (argc - 1)), & next_page);
7992         if (tmp___17) {   7992         if (tmp___17) {
7993           exit(1);   7993           exit(1);
7994         } else {   7994         } else {
7995     7995  
7996         }   7996         }
7997         tmp___18 = writeImageSections(in, out, & image, & page, sections,   7997         tmp___18 = writeImageSections(in, out, & image, & page, sections,
7998                                       & dump, sect_src, & sect_buff);   7998                                       & dump, sect_src, & sect_buff);
7999         if (tmp___18) {   7999         if (tmp___18) {
8000           TIFFError("main", "Unable to write image sections");   8000           TIFFError("main", "Unable to write image sections");
8001           exit(-1);   8001           exit(-1);
8002         } else {   8002         } else {
8003     8003  
8004         }   8004         }
8005       }   8005       }
8006       if (image_count == 0U) {   8006       if (image_count == 0U) {
8007         dirnum ++;   8007         dirnum ++;
8008       } else {   8008       } else {
8009         dirnum = (uint32 )((tdir_t )(imagelist[next_image] - 1U));   8009         dirnum = (uint32 )((tdir_t )(imagelist[next_image] - 1U));
8010         next_image ++;   8010         next_image ++;
8011       }   8011       }
8012       if (dirnum == 1023U) {   8012       if (dirnum == 1023U) {
8013         tmp___19 = TIFFNumberOfDirectories(in);   8013         tmp___19 = TIFFNumberOfDirectories(in);
8014         dirnum = (uint32 )((int )tmp___19 - 1);   8014         dirnum = (uint32 )((int )tmp___19 - 1);
8015       } else {   8015       } else {
8016     8016  
8017       }   8017       }
8018       tmp___20 = TIFFSetDirectory(in, (tdir_t )dirnum);   8018       tmp___20 = TIFFSetDirectory(in, (tdir_t )dirnum);
8019       if (tmp___20) {   8019       if (tmp___20) {
8020     8020  
8021       } else {   8021       } else {
8022         end_of_input = 1U;   8022         end_of_input = 1U;
8023       }   8023       }
8024     }   8024     }
8025     TIFFClose(in);   8025     TIFFClose(in);
8026     optind ++;   8026     optind ++;
8027   }   8027   }
8028   if (read_buff) {   8028   if (read_buff) {
8029     _TIFFfree((void *)read_buff);   8029     _TIFFfree((void *)read_buff);
8030   } else {   8030   } else {
8031     8031  
8032   }   8032   }
8033   if (crop_buff) {   8033   if (crop_buff) {
8034     _TIFFfree((void *)crop_buff);   8034     _TIFFfree((void *)crop_buff);
8035   } else {   8035   } else {
8036     8036  
8037   }   8037   }
8038   if (sect_buff) {   8038   if (sect_buff) {
8039     _TIFFfree((void *)sect_buff);   8039     _TIFFfree((void *)sect_buff);
8040   } else {   8040   } else {
8041     8041  
8042   }   8042   }
8043   seg = 0;   8043   seg = 0;
8044   while (seg < (int )crop.selections) {   8044   while (seg < (int )crop.selections) {
8045     _TIFFfree((void *)seg_buffs[seg].buffer);   8045     _TIFFfree((void *)seg_buffs[seg].buffer);
8046     seg ++;   8046     seg ++;
8047   }   8047   }
8048   if (dump.format != 0) {   8048   if (dump.format != 0) {
8049     if ((unsigned int )dump.infile != (unsigned int )((void *)0)) {   8049     if ((unsigned int )dump.infile != (unsigned int )((void *)0)) {
8050       fclose(dump.infile);   8050       fclose(dump.infile);
8051     } else {   8051     } else {
8052     8052  
8053     }   8053     }
8054     if ((unsigned int )dump.outfile != (unsigned int )((void *)0)) {   8054     if ((unsigned int )dump.outfile != (unsigned int )((void *)0)) {
8055       tmp___21 = TIFFFileName(out);   8055       tmp___21 = TIFFFileName(out);
8056       dump_info(dump.outfile, dump.format, (char *)"",   8056       dump_info(dump.outfile, dump.format, (char *)"",
8057                 (char *)"Completed run for %s", tmp___21);   8057                 (char *)"Completed run for %s", tmp___21);
8058       fclose(dump.outfile);   8058       fclose(dump.outfile);
8059     } else {   8059     } else {
8060     8060  
8061     }   8061     }
8062   } else {   8062   } else {
8063     8063  
8064   }   8064   }
8065   TIFFClose(out);   8065   TIFFClose(out);
8066   return (0);   8066   return (0);
8067 }   8067 }
8068 }   8068 }
8069 static int dump_data(FILE *dumpfile , int format , char *dump_tag ,   8069 static int dump_data(FILE *dumpfile , int format , char *dump_tag ,
8070                      unsigned char *data , uint32 count )   8070                      unsigned char *data , uint32 count )
8071 {   8071 {
8072   int j ;   8072   int j ;
8073   int k ;   8073   int k ;
8074   uint32 i ;   8074   uint32 i ;
8075   char dump_array[10] ;   8075   char dump_array[10] ;
8076   unsigned char bitset ;   8076   unsigned char bitset ;
8077   char const   *tmp ;   8077   char const   *tmp ;
8078   size_t tmp___0 ;   8078   size_t tmp___0 ;
8079     8079  
8080   {   8080   {
8081   if ((unsigned int )dumpfile == (unsigned int )((void *)0)) {   8081   if ((unsigned int )dumpfile == (unsigned int )((void *)0)) {
8082     TIFFError("", "Invalid FILE pointer for dump file\n");   8082     TIFFError("", "Invalid FILE pointer for dump file\n");
8083     return (1);   8083     return (1);
8084   } else {   8084   } else {
8085     8085  
8086   }   8086   }
8087   if (format == 1) {   8087   if (format == 1) {
8088     fprintf((FILE */* __restrict  */)dumpfile,   8088     fprintf((FILE */* __restrict  */)dumpfile,
8089             (char const   */* __restrict  */)" %s  ", dump_tag);   8089             (char const   */* __restrict  */)" %s  ", dump_tag);
8090     i = (uint32 )0;   8090     i = (uint32 )0;
8091     while (i < count) {   8091     while (i < count) {
8092       j = 0;   8092       j = 0;
8093       k = 7;   8093       k = 7;
8094       while (j < 8) {   8094       while (j < 8) {
8095         if ((int )*(data + i) & (1 << k)) {   8095         if ((int )*(data + i) & (1 << k)) {
8096           bitset = (unsigned char)1;   8096           bitset = (unsigned char)1;
8097         } else {   8097         } else {
8098           bitset = (unsigned char)0;   8098           bitset = (unsigned char)0;
8099         }   8099         }
8100         if (bitset) {   8100         if (bitset) {
8101           tmp = "1";   8101           tmp = "1";
8102         } else {   8102         } else {
8103           tmp = "0";   8103           tmp = "0";
8104         }   8104         }
8105         sprintf((char */* __restrict  */)(& dump_array[j]),   8105         sprintf((char */* __restrict  */)(& dump_array[j]),
8106                 (char const   */* __restrict  */)tmp);   8106                 (char const   */* __restrict  */)tmp);
8107         j ++;   8107         j ++;
8108         k --;   8108         k --;
8109       }   8109       }
8110       dump_array[8] = (char )'\000';   8110       dump_array[8] = (char )'\000';
8111       fprintf((FILE */* __restrict  */)dumpfile,   8111       fprintf((FILE */* __restrict  */)dumpfile,
8112               (char const   */* __restrict  */)" %s", dump_array);   8112               (char const   */* __restrict  */)" %s", dump_array);
8113       i ++;   8113       i ++;
8114     }   8114     }
8115     fprintf((FILE */* __restrict  */)dumpfile,   8115     fprintf((FILE */* __restrict  */)dumpfile,
8116             (char const   */* __restrict  */)"\n");   8116             (char const   */* __restrict  */)"\n");
8117   } else {   8117   } else {
8118     tmp___0 = fwrite((void const   */* __restrict  */)data, (size_t )1, count,   8118     tmp___0 = fwrite((void const   */* __restrict  */)data, (size_t )1, count,
8119                      (FILE */* __restrict  */)dumpfile);   8119                      (FILE */* __restrict  */)dumpfile);
8120     if (tmp___0 != count) {   8120     if (tmp___0 != count) {
8121       TIFFError("", "Unable to write binary data to dump file\n");   8121       TIFFError("", "Unable to write binary data to dump file\n");
8122       return (1);   8122       return (1);
8123     } else {   8123     } else {
8124     8124  
8125     }   8125     }
8126   }   8126   }
8127   return (0);   8127   return (0);
8128 }   8128 }
8129 }   8129 }
8130 static int dump_byte(FILE *dumpfile , int format , char *dump_tag ,   8130 static int dump_byte(FILE *dumpfile , int format , char *dump_tag ,
8131                      unsigned char data )   8131                      unsigned char data )
8132 {   8132 {
8133   int j ;   8133   int j ;
8134   int k ;   8134   int k ;
8135   char dump_array[10] ;   8135   char dump_array[10] ;
8136   unsigned char bitset ;   8136   unsigned char bitset ;
8137   char const   *tmp ;   8137   char const   *tmp ;
8138   size_t tmp___0 ;   8138   size_t tmp___0 ;
8139     8139  
8140   {   8140   {
8141   if ((unsigned int )dumpfile == (unsigned int )((void *)0)) {   8141   if ((unsigned int )dumpfile == (unsigned int )((void *)0)) {
8142     TIFFError("", "Invalid FILE pointer for dump file\n");   8142     TIFFError("", "Invalid FILE pointer for dump file\n");
8143     return (1);   8143     return (1);
8144   } else {   8144   } else {
8145     8145  
8146   }   8146   }
8147   if (format == 1) {   8147   if (format == 1) {
8148     fprintf((FILE */* __restrict  */)dumpfile,   8148     fprintf((FILE */* __restrict  */)dumpfile,
8149             (char const   */* __restrict  */)" %s  ", dump_tag);   8149             (char const   */* __restrict  */)" %s  ", dump_tag);
8150     j = 0;   8150     j = 0;
8151     k = 7;   8151     k = 7;
8152     while (j < 8) {   8152     while (j < 8) {
8153       if ((int )data & (1 << k)) {   8153       if ((int )data & (1 << k)) {
8154         bitset = (unsigned char)1;   8154         bitset = (unsigned char)1;
8155       } else {   8155       } else {
8156         bitset = (unsigned char)0;   8156         bitset = (unsigned char)0;
8157       }   8157       }
8158       if (bitset) {   8158       if (bitset) {
8159         tmp = "1";   8159         tmp = "1";
8160       } else {   8160       } else {
8161         tmp = "0";   8161         tmp = "0";
8162       }   8162       }
8163       sprintf((char */* __restrict  */)(& dump_array[j]),   8163       sprintf((char */* __restrict  */)(& dump_array[j]),
8164               (char const   */* __restrict  */)tmp);   8164               (char const   */* __restrict  */)tmp);
8165       j ++;   8165       j ++;
8166       k --;   8166       k --;
8167     }   8167     }
8168     dump_array[8] = (char )'\000';   8168     dump_array[8] = (char )'\000';
8169     fprintf((FILE */* __restrict  */)dumpfile,   8169     fprintf((FILE */* __restrict  */)dumpfile,
8170             (char const   */* __restrict  */)" %s\n", dump_array);   8170             (char const   */* __restrict  */)" %s\n", dump_array);
8171   } else {   8171   } else {
8172     tmp___0 = fwrite((void const   */* __restrict  */)(& data), (size_t )1,   8172     tmp___0 = fwrite((void const   */* __restrict  */)(& data), (size_t )1,
8173                      (size_t )1, (FILE */* __restrict  */)dumpfile);   8173                      (size_t )1, (FILE */* __restrict  */)dumpfile);
8174     if (tmp___0 != 1U) {   8174     if (tmp___0 != 1U) {
8175       TIFFError("", "Unable to write binary data to dump file\n");   8175       TIFFError("", "Unable to write binary data to dump file\n");
8176       return (1);   8176       return (1);
8177     } else {   8177     } else {
8178     8178  
8179     }   8179     }
8180   }   8180   }
8181   return (0);   8181   return (0);
8182 }   8182 }
8183 }   8183 }
8184 static int dump_short(FILE *dumpfile , int format , char *dump_tag ,   8184 static int dump_short(FILE *dumpfile , int format , char *dump_tag ,
8185                       uint16 data )   8185                       uint16 data )
8186 {   8186 {
8187   int j ;   8187   int j ;
8188   int k ;   8188   int k ;
8189   char dump_array[20] ;   8189   char dump_array[20] ;
8190   unsigned char bitset ;   8190   unsigned char bitset ;
8191   char const   *tmp ;   8191   char const   *tmp ;
8192   size_t tmp___0 ;   8192   size_t tmp___0 ;
8193     8193  
8194   {   8194   {
8195   if ((unsigned int )dumpfile == (unsigned int )((void *)0)) {   8195   if ((unsigned int )dumpfile == (unsigned int )((void *)0)) {
8196     TIFFError("", "Invalid FILE pointer for dump file\n");   8196     TIFFError("", "Invalid FILE pointer for dump file\n");
8197     return (1);   8197     return (1);
8198   } else {   8198   } else {
8199     8199  
8200   }   8200   }
8201   if (format == 1) {   8201   if (format == 1) {
8202     fprintf((FILE */* __restrict  */)dumpfile,   8202     fprintf((FILE */* __restrict  */)dumpfile,
8203             (char const   */* __restrict  */)" %s  ", dump_tag);   8203             (char const   */* __restrict  */)" %s  ", dump_tag);
8204     j = 0;   8204     j = 0;
8205     k = 15;   8205     k = 15;
8206     while (k >= 0) {   8206     while (k >= 0) {
8207       if ((int )data & (1 << k)) {   8207       if ((int )data & (1 << k)) {
8208         bitset = (unsigned char)1;   8208         bitset = (unsigned char)1;
8209       } else {   8209       } else {
8210         bitset = (unsigned char)0;   8210         bitset = (unsigned char)0;
8211       }   8211       }
8212       if (bitset) {   8212       if (bitset) {
8213         tmp = "1";   8213         tmp = "1";
8214       } else {   8214       } else {
8215         tmp = "0";   8215         tmp = "0";
8216       }   8216       }
8217       sprintf((char */* __restrict  */)(& dump_array[j]),   8217       sprintf((char */* __restrict  */)(& dump_array[j]),
8218               (char const   */* __restrict  */)tmp);   8218               (char const   */* __restrict  */)tmp);
8219       if (k % 8 == 0) {   8219       if (k % 8 == 0) {
8220         j ++;   8220         j ++;
8221         sprintf((char */* __restrict  */)(& dump_array[j]),   8221         sprintf((char */* __restrict  */)(& dump_array[j]),
8222                 (char const   */* __restrict  */)" ");   8222                 (char const   */* __restrict  */)" ");
8223       } else {   8223       } else {
8224     8224  
8225       }   8225       }
8226       j ++;   8226       j ++;
8227       k --;   8227       k --;
8228     }   8228     }
8229     dump_array[17] = (char )'\000';   8229     dump_array[17] = (char )'\000';
8230     fprintf((FILE */* __restrict  */)dumpfile,   8230     fprintf((FILE */* __restrict  */)dumpfile,
8231             (char const   */* __restrict  */)" %s\n", dump_array);   8231             (char const   */* __restrict  */)" %s\n", dump_array);
8232   } else {   8232   } else {
8233     tmp___0 = fwrite((void const   */* __restrict  */)(& data), (size_t )2,   8233     tmp___0 = fwrite((void const   */* __restrict  */)(& data), (size_t )2,
8234                      (size_t )1, (FILE */* __restrict  */)dumpfile);   8234                      (size_t )1, (FILE */* __restrict  */)dumpfile);
8235     if (tmp___0 != 2U) {   8235     if (tmp___0 != 2U) {
8236       TIFFError("", "Unable to write binary data to dump file\n");   8236       TIFFError("", "Unable to write binary data to dump file\n");
8237       return (1);   8237       return (1);
8238     } else {   8238     } else {
8239     8239  
8240     }   8240     }
8241   }   8241   }
8242   return (0);   8242   return (0);
8243 }   8243 }
8244 }   8244 }
8245 static int dump_long(FILE *dumpfile , int format , char *dump_tag , uint32 data )   8245 static int dump_long(FILE *dumpfile , int format , char *dump_tag , uint32 data )
8246 {   8246 {
8247   int j ;   8247   int j ;
8248   int k ;   8248   int k ;
8249   char dump_array[40] ;   8249   char dump_array[40] ;
8250   unsigned char bitset ;   8250   unsigned char bitset ;
8251   char const   *tmp ;   8251   char const   *tmp ;
8252   size_t tmp___0 ;   8252   size_t tmp___0 ;
8253     8253  
8254   {   8254   {
8255   if ((unsigned int )dumpfile == (unsigned int )((void *)0)) {   8255   if ((unsigned int )dumpfile == (unsigned int )((void *)0)) {
8256     TIFFError("", "Invalid FILE pointer for dump file\n");   8256     TIFFError("", "Invalid FILE pointer for dump file\n");
8257     return (1);   8257     return (1);
8258   } else {   8258   } else {
8259     8259  
8260   }   8260   }
8261   if (format == 1) {   8261   if (format == 1) {
8262     fprintf((FILE */* __restrict  */)dumpfile,   8262     fprintf((FILE */* __restrict  */)dumpfile,
8263             (char const   */* __restrict  */)" %s  ", dump_tag);   8263             (char const   */* __restrict  */)" %s  ", dump_tag);
8264     j = 0;   8264     j = 0;
8265     k = 31;   8265     k = 31;
8266     while (k >= 0) {   8266     while (k >= 0) {
8267       if (data & (1U << k)) {   8267       if (data & (1U << k)) {
8268         bitset = (unsigned char)1;   8268         bitset = (unsigned char)1;
8269       } else {   8269       } else {
8270         bitset = (unsigned char)0;   8270         bitset = (unsigned char)0;
8271       }   8271       }
8272       if (bitset) {   8272       if (bitset) {
8273         tmp = "1";   8273         tmp = "1";
8274       } else {   8274       } else {
8275         tmp = "0";   8275         tmp = "0";
8276       }   8276       }
8277       sprintf((char */* __restrict  */)(& dump_array[j]),   8277       sprintf((char */* __restrict  */)(& dump_array[j]),
8278               (char const   */* __restrict  */)tmp);   8278               (char const   */* __restrict  */)tmp);
8279       if (k % 8 == 0) {   8279       if (k % 8 == 0) {
8280         j ++;   8280         j ++;
8281         sprintf((char */* __restrict  */)(& dump_array[j]),   8281         sprintf((char */* __restrict  */)(& dump_array[j]),
8282                 (char const   */* __restrict  */)" ");   8282                 (char const   */* __restrict  */)" ");
8283       } else {   8283       } else {
8284     8284  
8285       }   8285       }
8286       j ++;   8286       j ++;
8287       k --;   8287       k --;
8288     }   8288     }
8289     dump_array[35] = (char )'\000';   8289     dump_array[35] = (char )'\000';
8290     fprintf((FILE */* __restrict  */)dumpfile,   8290     fprintf((FILE */* __restrict  */)dumpfile,
8291             (char const   */* __restrict  */)" %s\n", dump_array);   8291             (char const   */* __restrict  */)" %s\n", dump_array);
8292   } else {   8292   } else {
8293     tmp___0 = fwrite((void const   */* __restrict  */)(& data), (size_t )4,   8293     tmp___0 = fwrite((void const   */* __restrict  */)(& data), (size_t )4,
8294                      (size_t )1, (FILE */* __restrict  */)dumpfile);   8294                      (size_t )1, (FILE */* __restrict  */)dumpfile);
8295     if (tmp___0 != 4U) {   8295     if (tmp___0 != 4U) {
8296       TIFFError("", "Unable to write binary data to dump file\n");   8296       TIFFError("", "Unable to write binary data to dump file\n");
8297       return (1);   8297       return (1);
8298     } else {   8298     } else {
8299     8299  
8300     }   8300     }
8301   }   8301   }
8302   return (0);   8302   return (0);
8303 }   8303 }
8304 }   8304 }
8305 static int dump_wide(FILE *dumpfile , int format , char *dump_tag , uint64 data )   8305 static int dump_wide(FILE *dumpfile , int format , char *dump_tag , uint64 data )
8306 {   8306 {
8307   int j ;   8307   int j ;
8308   int k ;   8308   int k ;
8309   char dump_array[80] ;   8309   char dump_array[80] ;
8310   unsigned char bitset ;   8310   unsigned char bitset ;
8311   char const   *tmp ;   8311   char const   *tmp ;
8312   size_t tmp___0 ;   8312   size_t tmp___0 ;
8313     8313  
8314   {   8314   {
8315   if ((unsigned int )dumpfile == (unsigned int )((void *)0)) {   8315   if ((unsigned int )dumpfile == (unsigned int )((void *)0)) {
8316     TIFFError("", "Invalid FILE pointer for dump file\n");   8316     TIFFError("", "Invalid FILE pointer for dump file\n");
8317     return (1);   8317     return (1);
8318   } else {   8318   } else {
8319     8319  
8320   }   8320   }
8321   if (format == 1) {   8321   if (format == 1) {
8322     fprintf((FILE */* __restrict  */)dumpfile,   8322     fprintf((FILE */* __restrict  */)dumpfile,
8323             (char const   */* __restrict  */)" %s  ", dump_tag);   8323             (char const   */* __restrict  */)" %s  ", dump_tag);
8324     j = 0;   8324     j = 0;
8325     k = 63;   8325     k = 63;
8326     while (k >= 0) {   8326     while (k >= 0) {
8327       if (data & (1ULL << k)) {   8327       if (data & (1ULL << k)) {
8328         bitset = (unsigned char)1;   8328         bitset = (unsigned char)1;
8329       } else {   8329       } else {
8330         bitset = (unsigned char)0;   8330         bitset = (unsigned char)0;
8331       }   8331       }
8332       if (bitset) {   8332       if (bitset) {
8333         tmp = "1";   8333         tmp = "1";
8334       } else {   8334       } else {
8335         tmp = "0";   8335         tmp = "0";
8336       }   8336       }
8337       sprintf((char */* __restrict  */)(& dump_array[j]),   8337       sprintf((char */* __restrict  */)(& dump_array[j]),
8338               (char const   */* __restrict  */)tmp);   8338               (char const   */* __restrict  */)tmp);
8339       if (k % 8 == 0) {   8339       if (k % 8 == 0) {
8340         j ++;   8340         j ++;
8341         sprintf((char */* __restrict  */)(& dump_array[j]),   8341         sprintf((char */* __restrict  */)(& dump_array[j]),
8342                 (char const   */* __restrict  */)" ");   8342                 (char const   */* __restrict  */)" ");
8343       } else {   8343       } else {
8344     8344  
8345       }   8345       }
8346       j ++;   8346       j ++;
8347       k --;   8347       k --;
8348     }   8348     }
8349     dump_array[71] = (char )'\000';   8349     dump_array[71] = (char )'\000';
8350     fprintf((FILE */* __restrict  */)dumpfile,   8350     fprintf((FILE */* __restrict  */)dumpfile,
8351             (char const   */* __restrict  */)" %s\n", dump_array);   8351             (char const   */* __restrict  */)" %s\n", dump_array);
8352   } else {   8352   } else {
8353     tmp___0 = fwrite((void const   */* __restrict  */)(& data), (size_t )8,   8353     tmp___0 = fwrite((void const   */* __restrict  */)(& data), (size_t )8,
8354                      (size_t )1, (FILE */* __restrict  */)dumpfile);   8354                      (size_t )1, (FILE */* __restrict  */)dumpfile);
8355     if (tmp___0 != 8U) {   8355     if (tmp___0 != 8U) {
8356       TIFFError("", "Unable to write binary data to dump file\n");   8356       TIFFError("", "Unable to write binary data to dump file\n");
8357       return (1);   8357       return (1);
8358     } else {   8358     } else {
8359     8359  
8360     }   8360     }
8361   }   8361   }
8362   return (0);   8362   return (0);
8363 }   8363 }
8364 }   8364 }
8365 static void dump_info(FILE *dumpfile , int format , char *prefix , char *msg   8365 static void dump_info(FILE *dumpfile , int format , char *prefix , char *msg
8366                       , ...)   8366                       , ...)
8367 {   8367 {
8368   va_list ap ;   8368   va_list ap ;
8369     8369  
8370   {   8370   {
8371   if (format == 1) {   8371   if (format == 1) {
8372     __builtin_va_start(ap, msg);   8372     __builtin_va_start(ap, msg);
8373     fprintf((FILE */* __restrict  */)dumpfile,   8373     fprintf((FILE */* __restrict  */)dumpfile,
8374             (char const   */* __restrict  */)"%s ", prefix);   8374             (char const   */* __restrict  */)"%s ", prefix);
8375     vfprintf((FILE */* __restrict  */)dumpfile,   8375     vfprintf((FILE */* __restrict  */)dumpfile,
8376              (char const   */* __restrict  */)msg, ap);   8376              (char const   */* __restrict  */)msg, ap);
8377     fprintf((FILE */* __restrict  */)dumpfile,   8377     fprintf((FILE */* __restrict  */)dumpfile,
8378             (char const   */* __restrict  */)"\n");   8378             (char const   */* __restrict  */)"\n");
8379   } else {   8379   } else {
8380     8380  
8381   }   8381   }
8382   return;   8382   return;
8383 }   8383 }
8384 }   8384 }
8385 static int dump_buffer(FILE *dumpfile , int format , uint32 rows ,   8385 static int dump_buffer(FILE *dumpfile , int format , uint32 rows ,
8386                        uint32 width , uint32 row , unsigned char *buff )   8386                        uint32 width , uint32 row , unsigned char *buff )
8387 {   8387 {
8388   int j ;   8388   int j ;
8389   int k ;   8389   int k ;
8390   uint32 i ;   8390   uint32 i ;
8391   unsigned char *dump_ptr ;   8391   unsigned char *dump_ptr ;
8392     8392  
8393   {   8393   {
8394   if ((unsigned int )dumpfile == (unsigned int )((void *)0)) {   8394   if ((unsigned int )dumpfile == (unsigned int )((void *)0)) {
8395     TIFFError("", "Invalid FILE pointer for dump file\n");   8395     TIFFError("", "Invalid FILE pointer for dump file\n");
8396     return (1);   8396     return (1);
8397   } else {   8397   } else {
8398     8398  
8399   }   8399   }
8400   i = (uint32 )0;   8400   i = (uint32 )0;
8401   while (i < rows) {   8401   while (i < rows) {
8402     dump_ptr = buff + i * width;   8402     dump_ptr = buff + i * width;
8403     if (format == 1) {   8403     if (format == 1) {
8404       dump_info(dumpfile, format, (char *)"",   8404       dump_info(dumpfile, format, (char *)"",
8405                 (char *)"Row %4d, %d bytes at offset %d", (row + i) + 1U, width,   8405                 (char *)"Row %4d, %d bytes at offset %d", (row + i) + 1U, width,
8406                 row * width);   8406                 row * width);
8407     } else {   8407     } else {
8408     8408  
8409     }   8409     }
8410     j = 0;   8410     j = 0;
8411     k = (int )width;   8411     k = (int )width;
8412     while (k >= 10) {   8412     while (k >= 10) {
8413       dump_data(dumpfile, format, (char *)"", dump_ptr, (uint32 )10);   8413       dump_data(dumpfile, format, (char *)"", dump_ptr, (uint32 )10);
8414       j += 10;   8414       j += 10;
8415       k -= 10;   8415       k -= 10;
8416       dump_ptr += 10;   8416       dump_ptr += 10;
8417     }   8417     }
8418     if (k > 0) {   8418     if (k > 0) {
8419       dump_data(dumpfile, format, (char *)"", dump_ptr, (uint32 )k);   8419       dump_data(dumpfile, format, (char *)"", dump_ptr, (uint32 )k);
8420     } else {   8420     } else {
8421     8421  
8422     }   8422     }
8423     i ++;   8423     i ++;
8424   }   8424   }
8425   return (0);   8425   return (0);
8426 }   8426 }
8427 }   8427 }
8428 static int extractContigSamplesBytes(uint8 *in , uint8 *out , uint32 cols ,   8428 static int extractContigSamplesBytes(uint8 *in , uint8 *out , uint32 cols ,
8429                                      tsample_t sample , uint16 spp ,   8429                                      tsample_t sample , uint16 spp ,
8430                                      uint16 bps , tsample_t count ,   8430                                      uint16 bps , tsample_t count ,
8431                                      uint32 start , uint32 end )   8431                                      uint32 start , uint32 end )
8432 {   8432 {
8433   int i ;   8433   int i ;
8434   int bytes_per_sample ;   8434   int bytes_per_sample ;
8435   int sindex ;   8435   int sindex ;
8436   uint32 col ;   8436   uint32 col ;
8437   uint32 dst_rowsize ;   8437   uint32 dst_rowsize ;
8438   uint32 bit_offset ;   8438   uint32 bit_offset ;
8439   uint32 src_byte ;   8439   uint32 src_byte ;
8440   uint32 src_bit ;   8440   uint32 src_bit ;
8441   uint8 *src ;   8441   uint8 *src ;
8442   uint8 *dst ;   8442   uint8 *dst ;
8443   uint8 *tmp ;   8443   uint8 *tmp ;
8444   uint8 *tmp___0 ;   8444   uint8 *tmp___0 ;
8445     8445  
8446   {   8446   {
8447   src = in;   8447   src = in;
8448   dst = out;   8448   dst = out;
8449   if ((unsigned int )src == (unsigned int )((void *)0)) {   8449   if ((unsigned int )src == (unsigned int )((void *)0)) {
8450     TIFFError("extractContigSamplesBytes", "Invalid input or output buffer");   8450     TIFFError("extractContigSamplesBytes", "Invalid input or output buffer");
8451     return (1);   8451     return (1);
8452   } else   8452   } else
8453   if ((unsigned int )dst == (unsigned int )((void *)0)) {   8453   if ((unsigned int )dst == (unsigned int )((void *)0)) {
8454     TIFFError("extractContigSamplesBytes", "Invalid input or output buffer");   8454     TIFFError("extractContigSamplesBytes", "Invalid input or output buffer");
8455     return (1);   8455     return (1);
8456   } else {   8456   } else {
8457     8457  
8458   }   8458   }
8459   if (start > end) {   8459   if (start > end) {
8460     TIFFError("extractContigSamplesBytes",   8460     TIFFError("extractContigSamplesBytes",
8461               "Invalid start column value %d ignored", start);   8461               "Invalid start column value %d ignored", start);
8462     start = (uint32 )0;   8462     start = (uint32 )0;
8463   } else   8463   } else
8464   if (start > cols) {   8464   if (start > cols) {
8465     TIFFError("extractContigSamplesBytes",   8465     TIFFError("extractContigSamplesBytes",
8466               "Invalid start column value %d ignored", start);   8466               "Invalid start column value %d ignored", start);
8467     start = (uint32 )0;   8467     start = (uint32 )0;
8468   } else {   8468   } else {
8469     8469  
8470   }   8470   }
8471   if (end == 0U) {   8471   if (end == 0U) {
8472     TIFFError("extractContigSamplesBytes",   8472     TIFFError("extractContigSamplesBytes",
8473               "Invalid end column value %d ignored", end);   8473               "Invalid end column value %d ignored", end);
8474     end = cols;   8474     end = cols;
8475   } else   8475   } else
8476   if (end > cols) {   8476   if (end > cols) {
8477     TIFFError("extractContigSamplesBytes",   8477     TIFFError("extractContigSamplesBytes",
8478               "Invalid end column value %d ignored", end);   8478               "Invalid end column value %d ignored", end);
8479     end = cols;   8479     end = cols;
8480   } else {   8480   } else {
8481     8481  
8482   }   8482   }
8483   dst_rowsize = (((uint32 )bps * (end - start)) * (uint32 )count) / 8U;   8483   dst_rowsize = (((uint32 )bps * (end - start)) * (uint32 )count) / 8U;
8484   bytes_per_sample = ((int )bps + 7) / 8;   8484   bytes_per_sample = ((int )bps + 7) / 8;
8485   if ((int )count == (int )spp) {   8485   if ((int )count == (int )spp) {
8486     src = in + (start * (uint32 )spp) * (uint32 )bytes_per_sample;   8486     src = in + (start * (uint32 )spp) * (uint32 )bytes_per_sample;
8487     _TIFFmemcpy((void *)dst, (void const   *)src, (tmsize_t )dst_rowsize);   8487     _TIFFmemcpy((void *)dst, (void const   *)src, (tmsize_t )dst_rowsize);
8488   } else {   8488   } else {
8489     col = start;   8489     col = start;
8490     while (col < end) {   8490     while (col < end) {
8491       sindex = (int )sample;   8491       sindex = (int )sample;
8492       while (1) {   8492       while (1) {
8493         if (sindex < (int )spp) {   8493         if (sindex < (int )spp) {
8494           if (sindex < (int )sample + (int )count) {   8494           if (sindex < (int )sample + (int )count) {
8495     8495  
8496           } else {   8496           } else {
8497             break;   8497             break;
8498           }   8498           }
8499         } else {   8499         } else {
8500           break;   8500           break;
8501         }   8501         }
8502         bit_offset = (col * (uint32 )bps) * (uint32 )spp;   8502         bit_offset = (col * (uint32 )bps) * (uint32 )spp;
8503         if (sindex == 0) {   8503         if (sindex == 0) {
8504           src_byte = bit_offset / 8U;   8504           src_byte = bit_offset / 8U;
8505           src_bit = bit_offset % 8U;   8505           src_bit = bit_offset % 8U;
8506         } else {   8506         } else {
8507           src_byte = (bit_offset + (uint32 )(sindex * (int )bps)) / 8U;   8507           src_byte = (bit_offset + (uint32 )(sindex * (int )bps)) / 8U;
8508           src_bit = (bit_offset + (uint32 )(sindex * (int )bps)) % 8U;   8508           src_bit = (bit_offset + (uint32 )(sindex * (int )bps)) % 8U;
8509         }   8509         }
8510         src = in + src_byte;   8510         src = in + src_byte;
8511         i = 0;   8511         i = 0;
8512         while (i < bytes_per_sample) {   8512         while (i < bytes_per_sample) {
8513           tmp = dst;   8513           tmp = dst;
8514           dst ++;   8514           dst ++;
8515           tmp___0 = src;   8515           tmp___0 = src;
8516           src ++;   8516           src ++;
8517           *tmp = *tmp___0;   8517           *tmp = *tmp___0;
8518           i ++;   8518           i ++;
8519         }   8519         }
8520         sindex ++;   8520         sindex ++;
8521       }   8521       }
8522       col ++;   8522       col ++;
8523     }   8523     }
8524   }   8524   }
8525   return (0);   8525   return (0);
8526 }   8526 }
8527 }   8527 }
8528 static int extractContigSamples8bits(uint8 *in , uint8 *out , uint32 cols ,   8528 static int extractContigSamples8bits(uint8 *in , uint8 *out , uint32 cols ,
8529                                      tsample_t sample , uint16 spp ,   8529                                      tsample_t sample , uint16 spp ,
8530                                      uint16 bps , tsample_t count ,   8530                                      uint16 bps , tsample_t count ,
8531                                      uint32 start , uint32 end )   8531                                      uint32 start , uint32 end )
8532 {   8532 {
8533   int ready_bits ;   8533   int ready_bits ;
8534   int sindex ;   8534   int sindex ;
8535   uint32 col ;   8535   uint32 col ;
8536   uint32 src_byte ;   8536   uint32 src_byte ;
8537   uint32 src_bit ;   8537   uint32 src_bit ;
8538   uint32 bit_offset ;   8538   uint32 bit_offset ;
8539   uint8 maskbits ;   8539   uint8 maskbits ;
8540   uint8 matchbits ;   8540   uint8 matchbits ;
8541   uint8 buff1 ;   8541   uint8 buff1 ;
8542   uint8 buff2 ;   8542   uint8 buff2 ;
8543   uint8 *src ;   8543   uint8 *src ;
8544   uint8 *dst ;   8544   uint8 *dst ;
8545   uint8 *tmp ;   8545   uint8 *tmp ;
8546   uint8 *tmp___0 ;   8546   uint8 *tmp___0 ;
8547     8547  
8548   {   8548   {
8549   ready_bits = 0;   8549   ready_bits = 0;
8550   sindex = 0;   8550   sindex = 0;
8551   maskbits = (uint8 )0;   8551   maskbits = (uint8 )0;
8552   matchbits = (uint8 )0;   8552   matchbits = (uint8 )0;
8553   buff1 = (uint8 )0;   8553   buff1 = (uint8 )0;
8554   buff2 = (uint8 )0;   8554   buff2 = (uint8 )0;
8555   src = in;   8555   src = in;
8556   dst = out;   8556   dst = out;
8557   if ((unsigned int )src == (unsigned int )((void *)0)) {   8557   if ((unsigned int )src == (unsigned int )((void *)0)) {
8558     TIFFError("extractContigSamples8bits", "Invalid input or output buffer");   8558     TIFFError("extractContigSamples8bits", "Invalid input or output buffer");
8559     return (1);   8559     return (1);
8560   } else   8560   } else
8561   if ((unsigned int )dst == (unsigned int )((void *)0)) {   8561   if ((unsigned int )dst == (unsigned int )((void *)0)) {
8562     TIFFError("extractContigSamples8bits", "Invalid input or output buffer");   8562     TIFFError("extractContigSamples8bits", "Invalid input or output buffer");
8563     return (1);   8563     return (1);
8564   } else {   8564   } else {
8565     8565  
8566   }   8566   }
8567   if (start > end) {   8567   if (start > end) {
8568     TIFFError("extractContigSamples8bits",   8568     TIFFError("extractContigSamples8bits",
8569               "Invalid start column value %d ignored", start);   8569               "Invalid start column value %d ignored", start);
8570     start = (uint32 )0;   8570     start = (uint32 )0;
8571   } else   8571   } else
8572   if (start > cols) {   8572   if (start > cols) {
8573     TIFFError("extractContigSamples8bits",   8573     TIFFError("extractContigSamples8bits",
8574               "Invalid start column value %d ignored", start);   8574               "Invalid start column value %d ignored", start);
8575     start = (uint32 )0;   8575     start = (uint32 )0;
8576   } else {   8576   } else {
8577     8577  
8578   }   8578   }
8579   if (end == 0U) {   8579   if (end == 0U) {
8580     TIFFError("extractContigSamples8bits",   8580     TIFFError("extractContigSamples8bits",
8581               "Invalid end column value %d ignored", end);   8581               "Invalid end column value %d ignored", end);
8582     end = cols;   8582     end = cols;
8583   } else   8583   } else
8584   if (end > cols) {   8584   if (end > cols) {
8585     TIFFError("extractContigSamples8bits",   8585     TIFFError("extractContigSamples8bits",
8586               "Invalid end column value %d ignored", end);   8586               "Invalid end column value %d ignored", end);
8587     end = cols;   8587     end = cols;
8588   } else {   8588   } else {
8589     8589  
8590   }   8590   }
8591   ready_bits = 0;   8591   ready_bits = 0;
8592   maskbits = (uint8 )(255 >> (8 - (int )bps));   8592   maskbits = (uint8 )(255 >> (8 - (int )bps));
8593   buff2 = (uint8 )0;   8593   buff2 = (uint8 )0;
8594   buff1 = buff2;   8594   buff1 = buff2;
8595   col = start;   8595   col = start;
8596   while (col < end) {   8596   while (col < end) {
8597     bit_offset = (col * (uint32 )bps) * (uint32 )spp;   8597     bit_offset = (col * (uint32 )bps) * (uint32 )spp;
8598     sindex = (int )sample;   8598     sindex = (int )sample;
8599     while (1) {   8599     while (1) {
8600       if (sindex < (int )spp) {   8600       if (sindex < (int )spp) {
8601         if (sindex < (int )sample + (int )count) {   8601         if (sindex < (int )sample + (int )count) {
8602     8602  
8603         } else {   8603         } else {
8604           break;   8604           break;
8605         }   8605         }
8606       } else {   8606       } else {
8607         break;   8607         break;
8608       }   8608       }
8609       if (sindex == 0) {   8609       if (sindex == 0) {
8610         src_byte = bit_offset / 8U;   8610         src_byte = bit_offset / 8U;
8611         src_bit = bit_offset % 8U;   8611         src_bit = bit_offset % 8U;
8612       } else {   8612       } else {
8613         src_byte = (bit_offset + (uint32 )(sindex * (int )bps)) / 8U;   8613         src_byte = (bit_offset + (uint32 )(sindex * (int )bps)) / 8U;
8614         src_bit = (bit_offset + (uint32 )(sindex * (int )bps)) % 8U;   8614         src_bit = (bit_offset + (uint32 )(sindex * (int )bps)) % 8U;
8615       }   8615       }
8616       src = in + src_byte;   8616       src = in + src_byte;
8617       matchbits = (uint8 )((int )maskbits << ((8U - src_bit) - (uint32 )bps));   8617       matchbits = (uint8 )((int )maskbits << ((8U - src_bit) - (uint32 )bps));
8618       buff1 = (uint8 )(((int )*src & (int )matchbits) << src_bit);   8618       buff1 = (uint8 )(((int )*src & (int )matchbits) << src_bit);
8619       if (ready_bits >= 8) {   8619       if (ready_bits >= 8) {
8620         tmp = dst;   8620         tmp = dst;
8621         dst ++;   8621         dst ++;
8622         *tmp = buff2;   8622         *tmp = buff2;
8623         buff2 = buff1;   8623         buff2 = buff1;
8624         ready_bits -= 8;   8624         ready_bits -= 8;
8625       } else {   8625       } else {
8626         buff2 = (uint8 )((int )buff2 | ((int )buff1 >> ready_bits));   8626         buff2 = (uint8 )((int )buff2 | ((int )buff1 >> ready_bits));
8627       }   8627       }
8628       ready_bits += (int )bps;   8628       ready_bits += (int )bps;
8629       sindex ++;   8629       sindex ++;
8630     }   8630     }
8631     col ++;   8631     col ++;
8632   }   8632   }
8633   while (ready_bits > 0) {   8633   while (ready_bits > 0) {
8634     buff1 = (uint8 )((unsigned int )buff2 & (255U << (8 - ready_bits)));   8634     buff1 = (uint8 )((unsigned int )buff2 & (255U << (8 - ready_bits)));
8635     tmp___0 = dst;   8635     tmp___0 = dst;
8636     dst ++;   8636     dst ++;
8637     *tmp___0 = buff1;   8637     *tmp___0 = buff1;
8638     ready_bits -= 8;   8638     ready_bits -= 8;
8639   }   8639   }
8640   return (0);   8640   return (0);
8641 }   8641 }
8642 }   8642 }
8643 static int extractContigSamples16bits(uint8 *in , uint8 *out , uint32 cols ,   8643 static int extractContigSamples16bits(uint8 *in , uint8 *out , uint32 cols ,
8644                                       tsample_t sample , uint16 spp ,   8644                                       tsample_t sample , uint16 spp ,
8645                                       uint16 bps , tsample_t count ,   8645                                       uint16 bps , tsample_t count ,
8646                                       uint32 start , uint32 end )   8646                                       uint32 start , uint32 end )
8647 {   8647 {
8648   int ready_bits ;   8648   int ready_bits ;
8649   int sindex ;   8649   int sindex ;
8650   uint32 col ;   8650   uint32 col ;
8651   uint32 src_byte ;   8651   uint32 src_byte ;
8652   uint32 src_bit ;   8652   uint32 src_bit ;
8653   uint32 bit_offset ;   8653   uint32 bit_offset ;
8654   uint16 maskbits ;   8654   uint16 maskbits ;
8655   uint16 matchbits ;   8655   uint16 matchbits ;
8656   uint16 buff1 ;   8656   uint16 buff1 ;
8657   uint16 buff2 ;   8657   uint16 buff2 ;
8658   uint8 bytebuff ;   8658   uint8 bytebuff ;
8659   uint8 *src ;   8659   uint8 *src ;
8660   uint8 *dst ;   8660   uint8 *dst ;
8661   unsigned char swapbuff[2] ;   8661   unsigned char swapbuff[2] ;
8662   uint8 *tmp ;   8662   uint8 *tmp ;
8663   uint8 *tmp___0 ;   8663   uint8 *tmp___0 ;
8664     8664  
8665   {   8665   {
8666   ready_bits = 0;   8666   ready_bits = 0;
8667   sindex = 0;   8667   sindex = 0;
8668   maskbits = (uint16 )0;   8668   maskbits = (uint16 )0;
8669   matchbits = (uint16 )0;   8669   matchbits = (uint16 )0;
8670   buff1 = (uint16 )0;   8670   buff1 = (uint16 )0;
8671   buff2 = (uint16 )0;   8671   buff2 = (uint16 )0;
8672   bytebuff = (uint8 )0;   8672   bytebuff = (uint8 )0;
8673   src = in;   8673   src = in;
8674   dst = out;   8674   dst = out;
8675   if ((unsigned int )src == (unsigned int )((void *)0)) {   8675   if ((unsigned int )src == (unsigned int )((void *)0)) {
8676     TIFFError("extractContigSamples16bits", "Invalid input or output buffer");   8676     TIFFError("extractContigSamples16bits", "Invalid input or output buffer");
8677     return (1);   8677     return (1);
8678   } else   8678   } else
8679   if ((unsigned int )dst == (unsigned int )((void *)0)) {   8679   if ((unsigned int )dst == (unsigned int )((void *)0)) {
8680     TIFFError("extractContigSamples16bits", "Invalid input or output buffer");   8680     TIFFError("extractContigSamples16bits", "Invalid input or output buffer");
8681     return (1);   8681     return (1);
8682   } else {   8682   } else {
8683     8683  
8684   }   8684   }
8685   if (start > end) {   8685   if (start > end) {
8686     TIFFError("extractContigSamples16bits",   8686     TIFFError("extractContigSamples16bits",
8687               "Invalid start column value %d ignored", start);   8687               "Invalid start column value %d ignored", start);
8688     start = (uint32 )0;   8688     start = (uint32 )0;
8689   } else   8689   } else
8690   if (start > cols) {   8690   if (start > cols) {
8691     TIFFError("extractContigSamples16bits",   8691     TIFFError("extractContigSamples16bits",
8692               "Invalid start column value %d ignored", start);   8692               "Invalid start column value %d ignored", start);
8693     start = (uint32 )0;   8693     start = (uint32 )0;
8694   } else {   8694   } else {
8695     8695  
8696   }   8696   }
8697   if (end == 0U) {   8697   if (end == 0U) {
8698     TIFFError("extractContigSamples16bits",   8698     TIFFError("extractContigSamples16bits",
8699               "Invalid end column value %d ignored", end);   8699               "Invalid end column value %d ignored", end);
8700     end = cols;   8700     end = cols;
8701   } else   8701   } else
8702   if (end > cols) {   8702   if (end > cols) {
8703     TIFFError("extractContigSamples16bits",   8703     TIFFError("extractContigSamples16bits",
8704               "Invalid end column value %d ignored", end);   8704               "Invalid end column value %d ignored", end);
8705     end = cols;   8705     end = cols;
8706   } else {   8706   } else {
8707     8707  
8708   }   8708   }
8709   ready_bits = 0;   8709   ready_bits = 0;
8710   maskbits = (uint16 )(65535 >> (16 - (int )bps));   8710   maskbits = (uint16 )(65535 >> (16 - (int )bps));
8711   col = start;   8711   col = start;
8712   while (col < end) {   8712   while (col < end) {
8713     bit_offset = (col * (uint32 )bps) * (uint32 )spp;   8713     bit_offset = (col * (uint32 )bps) * (uint32 )spp;
8714     sindex = (int )sample;   8714     sindex = (int )sample;
8715     while (1) {   8715     while (1) {
8716       if (sindex < (int )spp) {   8716       if (sindex < (int )spp) {
8717         if (sindex < (int )sample + (int )count) {   8717         if (sindex < (int )sample + (int )count) {
8718     8718  
8719         } else {   8719         } else {
8720           break;   8720           break;
8721         }   8721         }
8722       } else {   8722       } else {
8723         break;   8723         break;
8724       }   8724       }
8725       if (sindex == 0) {   8725       if (sindex == 0) {
8726         src_byte = bit_offset / 8U;   8726         src_byte = bit_offset / 8U;
8727         src_bit = bit_offset % 8U;   8727         src_bit = bit_offset % 8U;
8728       } else {   8728       } else {
8729         src_byte = (bit_offset + (uint32 )(sindex * (int )bps)) / 8U;   8729         src_byte = (bit_offset + (uint32 )(sindex * (int )bps)) / 8U;
8730         src_bit = (bit_offset + (uint32 )(sindex * (int )bps)) % 8U;   8730         src_bit = (bit_offset + (uint32 )(sindex * (int )bps)) % 8U;
8731       }   8731       }
8732       src = in + src_byte;   8732       src = in + src_byte;
8733       matchbits = (uint16 )((int )maskbits << ((16U - src_bit) - (uint32 )bps));   8733       matchbits = (uint16 )((int )maskbits << ((16U - src_bit) - (uint32 )bps));
8734       if (little_endian) {   8734       if (little_endian) {
8735         swapbuff[1] = *src;   8735         swapbuff[1] = *src;
8736         swapbuff[0] = *(src + 1);   8736         swapbuff[0] = *(src + 1);
8737       } else {   8737       } else {
8738         swapbuff[0] = *src;   8738         swapbuff[0] = *src;
8739         swapbuff[1] = *(src + 1);   8739         swapbuff[1] = *(src + 1);
8740       }   8740       }
8741       buff1 = *((uint16 *)(swapbuff));   8741       buff1 = *((uint16 *)(swapbuff));
8742       buff1 = (uint16 )(((int )buff1 & (int )matchbits) << src_bit);   8742       buff1 = (uint16 )(((int )buff1 & (int )matchbits) << src_bit);
8743       if (ready_bits < 8) {   8743       if (ready_bits < 8) {
8744         bytebuff = (uint8 )0;   8744         bytebuff = (uint8 )0;
8745         buff2 = (uint16 )((int )buff2 | ((int )buff1 >> ready_bits));   8745         buff2 = (uint16 )((int )buff2 | ((int )buff1 >> ready_bits));
8746       } else {   8746       } else {
8747         bytebuff = (uint8 )((int )buff2 >> 8);   8747         bytebuff = (uint8 )((int )buff2 >> 8);
8748         tmp = dst;   8748         tmp = dst;
8749         dst ++;   8749         dst ++;
8750         *tmp = bytebuff;   8750         *tmp = bytebuff;
8751         ready_bits -= 8;   8751         ready_bits -= 8;
8752         buff2 = (uint16 )(((int )buff2 << 8) | ((int )buff1 >> ready_bits));   8752         buff2 = (uint16 )(((int )buff2 << 8) | ((int )buff1 >> ready_bits));
8753       }   8753       }
8754       ready_bits += (int )bps;   8754       ready_bits += (int )bps;
8755       sindex ++;   8755       sindex ++;
8756     }   8756     }
8757     col ++;   8757     col ++;
8758   }   8758   }
8759   while (ready_bits > 0) {   8759   while (ready_bits > 0) {
8760     bytebuff = (uint8 )((int )buff2 >> 8);   8760     bytebuff = (uint8 )((int )buff2 >> 8);
8761     tmp___0 = dst;   8761     tmp___0 = dst;
8762     dst ++;   8762     dst ++;
8763     *tmp___0 = bytebuff;   8763     *tmp___0 = bytebuff;
8764     ready_bits -= 8;   8764     ready_bits -= 8;
8765   }   8765   }
8766   return (0);   8766   return (0);
8767 }   8767 }
8768 }   8768 }
8769 static int extractContigSamples24bits(uint8 *in , uint8 *out , uint32 cols ,   8769 static int extractContigSamples24bits(uint8 *in , uint8 *out , uint32 cols ,
8770                                       tsample_t sample , uint16 spp ,   8770                                       tsample_t sample , uint16 spp ,
8771                                       uint16 bps , tsample_t count ,   8771                                       uint16 bps , tsample_t count ,
8772                                       uint32 start , uint32 end )   8772                                       uint32 start , uint32 end )
8773 {   8773 {
8774   int ready_bits ;   8774   int ready_bits ;
8775   int sindex ;   8775   int sindex ;
8776   uint32 col ;   8776   uint32 col ;
8777   uint32 src_byte ;   8777   uint32 src_byte ;
8778   uint32 src_bit ;   8778   uint32 src_bit ;
8779   uint32 bit_offset ;   8779   uint32 bit_offset ;
8780   uint32 maskbits ;   8780   uint32 maskbits ;
8781   uint32 matchbits ;   8781   uint32 matchbits ;
8782   uint32 buff1 ;   8782   uint32 buff1 ;
8783   uint32 buff2 ;   8783   uint32 buff2 ;
8784   uint8 bytebuff1 ;   8784   uint8 bytebuff1 ;
8785   uint8 bytebuff2 ;   8785   uint8 bytebuff2 ;
8786   uint8 *src ;   8786   uint8 *src ;
8787   uint8 *dst ;   8787   uint8 *dst ;
8788   unsigned char swapbuff[4] ;   8788   unsigned char swapbuff[4] ;
8789   uint8 *tmp ;   8789   uint8 *tmp ;
8790   uint8 *tmp___0 ;   8790   uint8 *tmp___0 ;
8791   uint8 *tmp___1 ;   8791   uint8 *tmp___1 ;
8792     8792  
8793   {   8793   {
8794   ready_bits = 0;   8794   ready_bits = 0;
8795   sindex = 0;   8795   sindex = 0;
8796   maskbits = (uint32 )0;   8796   maskbits = (uint32 )0;
8797   matchbits = (uint32 )0;   8797   matchbits = (uint32 )0;
8798   buff1 = (uint32 )0;   8798   buff1 = (uint32 )0;
8799   buff2 = (uint32 )0;   8799   buff2 = (uint32 )0;
8800   bytebuff1 = (uint8 )0;   8800   bytebuff1 = (uint8 )0;
8801   bytebuff2 = (uint8 )0;   8801   bytebuff2 = (uint8 )0;
8802   src = in;   8802   src = in;
8803   dst = out;   8803   dst = out;
8804   if ((unsigned int )in == (unsigned int )((void *)0)) {   8804   if ((unsigned int )in == (unsigned int )((void *)0)) {
8805     TIFFError("extractContigSamples24bits", "Invalid input or output buffer");   8805     TIFFError("extractContigSamples24bits", "Invalid input or output buffer");
8806     return (1);   8806     return (1);
8807   } else   8807   } else
8808   if ((unsigned int )out == (unsigned int )((void *)0)) {   8808   if ((unsigned int )out == (unsigned int )((void *)0)) {
8809     TIFFError("extractContigSamples24bits", "Invalid input or output buffer");   8809     TIFFError("extractContigSamples24bits", "Invalid input or output buffer");
8810     return (1);   8810     return (1);
8811   } else {   8811   } else {
8812     8812  
8813   }   8813   }
8814   if (start > end) {   8814   if (start > end) {
8815     TIFFError("extractContigSamples24bits",   8815     TIFFError("extractContigSamples24bits",
8816               "Invalid start column value %d ignored", start);   8816               "Invalid start column value %d ignored", start);
8817     start = (uint32 )0;   8817     start = (uint32 )0;
8818   } else   8818   } else
8819   if (start > cols) {   8819   if (start > cols) {
8820     TIFFError("extractContigSamples24bits",   8820     TIFFError("extractContigSamples24bits",
8821               "Invalid start column value %d ignored", start);   8821               "Invalid start column value %d ignored", start);
8822     start = (uint32 )0;   8822     start = (uint32 )0;
8823   } else {   8823   } else {
8824     8824  
8825   }   8825   }
8826   if (end == 0U) {   8826   if (end == 0U) {
8827     TIFFError("extractContigSamples24bits",   8827     TIFFError("extractContigSamples24bits",
8828               "Invalid end column value %d ignored", end);   8828               "Invalid end column value %d ignored", end);
8829     end = cols;   8829     end = cols;
8830   } else   8830   } else
8831   if (end > cols) {   8831   if (end > cols) {
8832     TIFFError("extractContigSamples24bits",   8832     TIFFError("extractContigSamples24bits",
8833               "Invalid end column value %d ignored", end);   8833               "Invalid end column value %d ignored", end);
8834     end = cols;   8834     end = cols;
8835   } else {   8835   } else {
8836     8836  
8837   }   8837   }
8838   ready_bits = 0;   8838   ready_bits = 0;
8839   maskbits = 4294967295U >> (32 - (int )bps);   8839   maskbits = 4294967295U >> (32 - (int )bps);
8840   col = start;   8840   col = start;
8841   while (col < end) {   8841   while (col < end) {
8842     bit_offset = (col * (uint32 )bps) * (uint32 )spp;   8842     bit_offset = (col * (uint32 )bps) * (uint32 )spp;
8843     sindex = (int )sample;   8843     sindex = (int )sample;
8844     while (1) {   8844     while (1) {
8845       if (sindex < (int )spp) {   8845       if (sindex < (int )spp) {
8846         if (sindex < (int )sample + (int )count) {   8846         if (sindex < (int )sample + (int )count) {
8847     8847  
8848         } else {   8848         } else {
8849           break;   8849           break;
8850         }   8850         }
8851       } else {   8851       } else {
8852         break;   8852         break;
8853       }   8853       }
8854       if (sindex == 0) {   8854       if (sindex == 0) {
8855         src_byte = bit_offset / 8U;   8855         src_byte = bit_offset / 8U;
8856         src_bit = bit_offset % 8U;   8856         src_bit = bit_offset % 8U;
8857       } else {   8857       } else {
8858         src_byte = (bit_offset + (uint32 )(sindex * (int )bps)) / 8U;   8858         src_byte = (bit_offset + (uint32 )(sindex * (int )bps)) / 8U;
8859         src_bit = (bit_offset + (uint32 )(sindex * (int )bps)) % 8U;   8859         src_bit = (bit_offset + (uint32 )(sindex * (int )bps)) % 8U;
8860       }   8860       }
8861       src = in + src_byte;   8861       src = in + src_byte;
8862       matchbits = maskbits << ((32U - src_bit) - (uint32 )bps);   8862       matchbits = maskbits << ((32U - src_bit) - (uint32 )bps);
8863       if (little_endian) {   8863       if (little_endian) {
8864         swapbuff[3] = *src;   8864         swapbuff[3] = *src;
8865         swapbuff[2] = *(src + 1);   8865         swapbuff[2] = *(src + 1);
8866         swapbuff[1] = *(src + 2);   8866         swapbuff[1] = *(src + 2);
8867         swapbuff[0] = *(src + 3);   8867         swapbuff[0] = *(src + 3);
8868       } else {   8868       } else {
8869         swapbuff[0] = *src;   8869         swapbuff[0] = *src;
8870         swapbuff[1] = *(src + 1);   8870         swapbuff[1] = *(src + 1);
8871         swapbuff[2] = *(src + 2);   8871         swapbuff[2] = *(src + 2);
8872         swapbuff[3] = *(src + 3);   8872         swapbuff[3] = *(src + 3);
8873       }   8873       }
8874       buff1 = *((uint32 *)(swapbuff));   8874       buff1 = *((uint32 *)(swapbuff));
8875       buff1 = (buff1 & matchbits) << src_bit;   8875       buff1 = (buff1 & matchbits) << src_bit;
8876       if (ready_bits < 16) {   8876       if (ready_bits < 16) {
8877         bytebuff2 = (uint8 )0;   8877         bytebuff2 = (uint8 )0;
8878         bytebuff1 = bytebuff2;   8878         bytebuff1 = bytebuff2;
8879         buff2 |= buff1 >> ready_bits;   8879         buff2 |= buff1 >> ready_bits;
8880       } else {   8880       } else {
8881         bytebuff1 = (uint8 )(buff2 >> 24);   8881         bytebuff1 = (uint8 )(buff2 >> 24);
8882         tmp = dst;   8882         tmp = dst;
8883         dst ++;   8883         dst ++;
8884         *tmp = bytebuff1;   8884         *tmp = bytebuff1;
8885         bytebuff2 = (uint8 )(buff2 >> 16);   8885         bytebuff2 = (uint8 )(buff2 >> 16);
8886         tmp___0 = dst;   8886         tmp___0 = dst;
8887         dst ++;   8887         dst ++;
8888         *tmp___0 = bytebuff2;   8888         *tmp___0 = bytebuff2;
8889         ready_bits -= 16;   8889         ready_bits -= 16;
8890         buff2 = (buff2 << 16) | (buff1 >> ready_bits);   8890         buff2 = (buff2 << 16) | (buff1 >> ready_bits);
8891       }   8891       }
8892       ready_bits += (int )bps;   8892       ready_bits += (int )bps;
8893       sindex ++;   8893       sindex ++;
8894     }   8894     }
8895     col ++;   8895     col ++;
8896   }   8896   }
8897   while (ready_bits > 0) {   8897   while (ready_bits > 0) {
8898     bytebuff1 = (uint8 )(buff2 >> 24);   8898     bytebuff1 = (uint8 )(buff2 >> 24);
8899     tmp___1 = dst;   8899     tmp___1 = dst;
8900     dst ++;   8900     dst ++;
8901     *tmp___1 = bytebuff1;   8901     *tmp___1 = bytebuff1;
8902     buff2 <<= 8;   8902     buff2 <<= 8;
8903     bytebuff2 = bytebuff1;   8903     bytebuff2 = bytebuff1;
8904     ready_bits -= 8;   8904     ready_bits -= 8;
8905   }   8905   }
8906   return (0);   8906   return (0);
8907 }   8907 }
8908 }   8908 }
8909 static int extractContigSamples32bits(uint8 *in , uint8 *out , uint32 cols ,   8909 static int extractContigSamples32bits(uint8 *in , uint8 *out , uint32 cols ,
8910                                       tsample_t sample , uint16 spp ,   8910                                       tsample_t sample , uint16 spp ,
8911                                       uint16 bps , tsample_t count ,   8911                                       uint16 bps , tsample_t count ,
8912                                       uint32 start , uint32 end )   8912                                       uint32 start , uint32 end )
8913 {   8913 {
8914   int ready_bits ;   8914   int ready_bits ;
8915   int sindex ;   8915   int sindex ;
8916   int shift_width ;   8916   int shift_width ;
8917   uint32 col ;   8917   uint32 col ;
8918   uint32 src_byte ;   8918   uint32 src_byte ;
8919   uint32 src_bit ;   8919   uint32 src_bit ;
8920   uint32 bit_offset ;   8920   uint32 bit_offset ;
8921   uint32 longbuff1 ;   8921   uint32 longbuff1 ;
8922   uint32 longbuff2 ;   8922   uint32 longbuff2 ;
8923   uint64 maskbits ;   8923   uint64 maskbits ;
8924   uint64 matchbits ;   8924   uint64 matchbits ;
8925   uint64 buff1 ;   8925   uint64 buff1 ;
8926   uint64 buff2 ;   8926   uint64 buff2 ;
8927   uint64 buff3 ;   8927   uint64 buff3 ;
8928   uint8 bytebuff1 ;   8928   uint8 bytebuff1 ;
8929   uint8 bytebuff2 ;   8929   uint8 bytebuff2 ;
8930   uint8 bytebuff3 ;   8930   uint8 bytebuff3 ;
8931   uint8 bytebuff4 ;   8931   uint8 bytebuff4 ;
8932   uint8 *src ;   8932   uint8 *src ;
8933   uint8 *dst ;   8933   uint8 *dst ;
8934   unsigned char swapbuff1[4] ;   8934   unsigned char swapbuff1[4] ;
8935   unsigned char swapbuff2[4] ;   8935   unsigned char swapbuff2[4] ;
8936   uint8 *tmp ;   8936   uint8 *tmp ;
8937   uint8 *tmp___0 ;   8937   uint8 *tmp___0 ;
8938   uint8 *tmp___1 ;   8938   uint8 *tmp___1 ;
8939   uint8 *tmp___2 ;   8939   uint8 *tmp___2 ;
8940   uint8 *tmp___3 ;   8940   uint8 *tmp___3 ;
8941     8941  
8942   {   8942   {
8943   ready_bits = 0;   8943   ready_bits = 0;
8944   sindex = 0;   8944   sindex = 0;
8945   shift_width = 0;   8945   shift_width = 0;
8946   longbuff1 = (uint32 )0;   8946   longbuff1 = (uint32 )0;
8947   longbuff2 = (uint32 )0;   8947   longbuff2 = (uint32 )0;
8948   maskbits = (uint64 )0;   8948   maskbits = (uint64 )0;
8949   matchbits = (uint64 )0;   8949   matchbits = (uint64 )0;
8950   buff1 = (uint64 )0;   8950   buff1 = (uint64 )0;
8951   buff2 = (uint64 )0;   8951   buff2 = (uint64 )0;
8952   buff3 = (uint64 )0;   8952   buff3 = (uint64 )0;
8953   bytebuff1 = (uint8 )0;   8953   bytebuff1 = (uint8 )0;
8954   bytebuff2 = (uint8 )0;   8954   bytebuff2 = (uint8 )0;
8955   bytebuff3 = (uint8 )0;   8955   bytebuff3 = (uint8 )0;
8956   bytebuff4 = (uint8 )0;   8956   bytebuff4 = (uint8 )0;
8957   src = in;   8957   src = in;
8958   dst = out;   8958   dst = out;
8959   if ((unsigned int )in == (unsigned int )((void *)0)) {   8959   if ((unsigned int )in == (unsigned int )((void *)0)) {
8960     TIFFError("extractContigSamples32bits", "Invalid input or output buffer");   8960     TIFFError("extractContigSamples32bits", "Invalid input or output buffer");
8961     return (1);   8961     return (1);
8962   } else   8962   } else
8963   if ((unsigned int )out == (unsigned int )((void *)0)) {   8963   if ((unsigned int )out == (unsigned int )((void *)0)) {
8964     TIFFError("extractContigSamples32bits", "Invalid input or output buffer");   8964     TIFFError("extractContigSamples32bits", "Invalid input or output buffer");
8965     return (1);   8965     return (1);
8966   } else {   8966   } else {
8967     8967  
8968   }   8968   }
8969   if (start > end) {   8969   if (start > end) {
8970     TIFFError("extractContigSamples32bits",   8970     TIFFError("extractContigSamples32bits",
8971               "Invalid start column value %d ignored", start);   8971               "Invalid start column value %d ignored", start);
8972     start = (uint32 )0;   8972     start = (uint32 )0;
8973   } else   8973   } else
8974   if (start > cols) {   8974   if (start > cols) {
8975     TIFFError("extractContigSamples32bits",   8975     TIFFError("extractContigSamples32bits",
8976               "Invalid start column value %d ignored", start);   8976               "Invalid start column value %d ignored", start);
8977     start = (uint32 )0;   8977     start = (uint32 )0;
8978   } else {   8978   } else {
8979     8979  
8980   }   8980   }
8981   if (end == 0U) {   8981   if (end == 0U) {
8982     TIFFError("extractContigSamples32bits",   8982     TIFFError("extractContigSamples32bits",
8983               "Invalid end column value %d ignored", end);   8983               "Invalid end column value %d ignored", end);
8984     end = cols;   8984     end = cols;
8985   } else   8985   } else
8986   if (end > cols) {   8986   if (end > cols) {
8987     TIFFError("extractContigSamples32bits",   8987     TIFFError("extractContigSamples32bits",
8988               "Invalid end column value %d ignored", end);   8988               "Invalid end column value %d ignored", end);
8989     end = cols;   8989     end = cols;
8990   } else {   8990   } else {
8991     8991  
8992   }   8992   }
8993   shift_width = ((int )bps + 7) / 8 + 1;   8993   shift_width = ((int )bps + 7) / 8 + 1;
8994   ready_bits = 0;   8994   ready_bits = 0;
8995   maskbits = 0xffffffffffffffffULL >> (64 - (int )bps);   8995   maskbits = 0xffffffffffffffffULL >> (64 - (int )bps);
8996   col = start;   8996   col = start;
8997   while (col < end) {   8997   while (col < end) {
8998     bit_offset = (col * (uint32 )bps) * (uint32 )spp;   8998     bit_offset = (col * (uint32 )bps) * (uint32 )spp;
8999     sindex = (int )sample;   8999     sindex = (int )sample;
9000     while (1) {   9000     while (1) {
9001       if (sindex < (int )spp) {   9001       if (sindex < (int )spp) {
9002         if (sindex < (int )sample + (int )count) {   9002         if (sindex < (int )sample + (int )count) {
9003     9003  
9004         } else {   9004         } else {
9005           break;   9005           break;
9006         }   9006         }
9007       } else {   9007       } else {
9008         break;   9008         break;
9009       }   9009       }
9010       if (sindex == 0) {   9010       if (sindex == 0) {
9011         src_byte = bit_offset / 8U;   9011         src_byte = bit_offset / 8U;
9012         src_bit = bit_offset % 8U;   9012         src_bit = bit_offset % 8U;
9013       } else {   9013       } else {
9014         src_byte = (bit_offset + (uint32 )(sindex * (int )bps)) / 8U;   9014         src_byte = (bit_offset + (uint32 )(sindex * (int )bps)) / 8U;
9015         src_bit = (bit_offset + (uint32 )(sindex * (int )bps)) % 8U;   9015         src_bit = (bit_offset + (uint32 )(sindex * (int )bps)) % 8U;
9016       }   9016       }
9017       src = in + src_byte;   9017       src = in + src_byte;
9018       matchbits = maskbits << ((64U - src_bit) - (uint32 )bps);   9018       matchbits = maskbits << ((64U - src_bit) - (uint32 )bps);
9019       if (little_endian) {   9019       if (little_endian) {
9020         swapbuff1[3] = *src;   9020         swapbuff1[3] = *src;
9021         swapbuff1[2] = *(src + 1);   9021         swapbuff1[2] = *(src + 1);
9022         swapbuff1[1] = *(src + 2);   9022         swapbuff1[1] = *(src + 2);
9023         swapbuff1[0] = *(src + 3);   9023         swapbuff1[0] = *(src + 3);
9024       } else {   9024       } else {
9025         swapbuff1[0] = *src;   9025         swapbuff1[0] = *src;
9026         swapbuff1[1] = *(src + 1);   9026         swapbuff1[1] = *(src + 1);
9027         swapbuff1[2] = *(src + 2);   9027         swapbuff1[2] = *(src + 2);
9028         swapbuff1[3] = *(src + 3);   9028         swapbuff1[3] = *(src + 3);
9029       }   9029       }
9030       longbuff1 = *((uint32 *)(swapbuff1));   9030       longbuff1 = *((uint32 *)(swapbuff1));
9031       memset((void *)(swapbuff2), '\000', sizeof(swapbuff2));   9031       memset((void *)(swapbuff2), '\000', sizeof(swapbuff2));
9032       if (little_endian) {   9032       if (little_endian) {
9033         swapbuff2[3] = *src;   9033         swapbuff2[3] = *src;
9034         swapbuff2[2] = *(src + 1);   9034         swapbuff2[2] = *(src + 1);
9035         swapbuff2[1] = *(src + 2);   9035         swapbuff2[1] = *(src + 2);
9036         swapbuff2[0] = *(src + 3);   9036         swapbuff2[0] = *(src + 3);
9037       } else {   9037       } else {
9038         swapbuff2[0] = *src;   9038         swapbuff2[0] = *src;
9039         swapbuff2[1] = *(src + 1);   9039         swapbuff2[1] = *(src + 1);
9040         swapbuff2[2] = *(src + 2);   9040         swapbuff2[2] = *(src + 2);
9041         swapbuff2[3] = *(src + 3);   9041         swapbuff2[3] = *(src + 3);
9042       }   9042       }
9043       longbuff2 = *((uint32 *)(swapbuff2));   9043       longbuff2 = *((uint32 *)(swapbuff2));
9044       buff3 = ((uint64 )longbuff1 << 32) | (unsigned long long )longbuff2;   9044       buff3 = ((uint64 )longbuff1 << 32) | (unsigned long long )longbuff2;
9045       buff1 = (buff3 & matchbits) << src_bit;   9045       buff1 = (buff3 & matchbits) << src_bit;
9046       if (ready_bits >= 32) {   9046       if (ready_bits >= 32) {
9047         bytebuff1 = (uint8 )(buff2 >> 56);   9047         bytebuff1 = (uint8 )(buff2 >> 56);
9048         tmp = dst;   9048         tmp = dst;
9049         dst ++;   9049         dst ++;
9050         *tmp = bytebuff1;   9050         *tmp = bytebuff1;
9051         bytebuff2 = (uint8 )(buff2 >> 48);   9051         bytebuff2 = (uint8 )(buff2 >> 48);
9052         tmp___0 = dst;   9052         tmp___0 = dst;
9053         dst ++;   9053         dst ++;
9054         *tmp___0 = bytebuff2;   9054         *tmp___0 = bytebuff2;
9055         bytebuff3 = (uint8 )(buff2 >> 40);   9055         bytebuff3 = (uint8 )(buff2 >> 40);
9056         tmp___1 = dst;   9056         tmp___1 = dst;
9057         dst ++;   9057         dst ++;
9058         *tmp___1 = bytebuff3;   9058         *tmp___1 = bytebuff3;
9059         bytebuff4 = (uint8 )(buff2 >> 32);   9059         bytebuff4 = (uint8 )(buff2 >> 32);
9060         tmp___2 = dst;   9060         tmp___2 = dst;
9061         dst ++;   9061         dst ++;
9062         *tmp___2 = bytebuff4;   9062         *tmp___2 = bytebuff4;
9063         ready_bits -= 32;   9063         ready_bits -= 32;
9064         buff2 = (buff2 << 32) | (buff1 >> ready_bits);   9064         buff2 = (buff2 << 32) | (buff1 >> ready_bits);
9065       } else {   9065       } else {
9066         bytebuff4 = (uint8 )0;   9066         bytebuff4 = (uint8 )0;
9067         bytebuff3 = bytebuff4;   9067         bytebuff3 = bytebuff4;
9068         bytebuff2 = bytebuff3;   9068         bytebuff2 = bytebuff3;
9069         bytebuff1 = bytebuff2;   9069         bytebuff1 = bytebuff2;
9070         buff2 |= buff1 >> ready_bits;   9070         buff2 |= buff1 >> ready_bits;
9071       }   9071       }
9072       ready_bits += (int )bps;   9072       ready_bits += (int )bps;
9073       sindex ++;   9073       sindex ++;
9074     }   9074     }
9075     col ++;   9075     col ++;
9076   }   9076   }
9077   while (ready_bits > 0) {   9077   while (ready_bits > 0) {
9078     bytebuff1 = (uint8 )(buff2 >> 56);   9078     bytebuff1 = (uint8 )(buff2 >> 56);
9079     tmp___3 = dst;   9079     tmp___3 = dst;
9080     dst ++;   9080     dst ++;
9081     *tmp___3 = bytebuff1;   9081     *tmp___3 = bytebuff1;
9082     buff2 <<= 8;   9082     buff2 <<= 8;
9083     ready_bits -= 8;   9083     ready_bits -= 8;
9084   }   9084   }
9085   return (0);   9085   return (0);
9086 }   9086 }
9087 }   9087 }
9088 static int extractContigSamplesShifted8bits(uint8 *in , uint8 *out ,   9088 static int extractContigSamplesShifted8bits(uint8 *in , uint8 *out ,
9089                                             uint32 cols , tsample_t sample ,   9089                                             uint32 cols , tsample_t sample ,
9090                                             uint16 spp , uint16 bps ,   9090                                             uint16 spp , uint16 bps ,
9091                                             tsample_t count , uint32 start ,   9091                                             tsample_t count , uint32 start ,
9092                                             uint32 end , int shift )   9092                                             uint32 end , int shift )
9093 {   9093 {
9094   int ready_bits ;   9094   int ready_bits ;
9095   int sindex ;   9095   int sindex ;
9096   uint32 col ;   9096   uint32 col ;
9097   uint32 src_byte ;   9097   uint32 src_byte ;
9098   uint32 src_bit ;   9098   uint32 src_bit ;
9099   uint32 bit_offset ;   9099   uint32 bit_offset ;
9100   uint8 maskbits ;   9100   uint8 maskbits ;
9101   uint8 matchbits ;   9101   uint8 matchbits ;
9102   uint8 buff1 ;   9102   uint8 buff1 ;
9103   uint8 buff2 ;   9103   uint8 buff2 ;
9104   uint8 *src ;   9104   uint8 *src ;
9105   uint8 *dst ;   9105   uint8 *dst ;
9106   uint8 *tmp ;   9106   uint8 *tmp ;
9107   uint8 *tmp___0 ;   9107   uint8 *tmp___0 ;
9108     9108  
9109   {   9109   {
9110   ready_bits = 0;   9110   ready_bits = 0;
9111   sindex = 0;   9111   sindex = 0;
9112   maskbits = (uint8 )0;   9112   maskbits = (uint8 )0;
9113   matchbits = (uint8 )0;   9113   matchbits = (uint8 )0;
9114   buff1 = (uint8 )0;   9114   buff1 = (uint8 )0;
9115   buff2 = (uint8 )0;   9115   buff2 = (uint8 )0;
9116   src = in;   9116   src = in;
9117   dst = out;   9117   dst = out;
9118   if ((unsigned int )src == (unsigned int )((void *)0)) {   9118   if ((unsigned int )src == (unsigned int )((void *)0)) {
9119     TIFFError("extractContigSamplesShifted8bits",   9119     TIFFError("extractContigSamplesShifted8bits",
9120               "Invalid input or output buffer");   9120               "Invalid input or output buffer");
9121     return (1);   9121     return (1);
9122   } else   9122   } else
9123   if ((unsigned int )dst == (unsigned int )((void *)0)) {   9123   if ((unsigned int )dst == (unsigned int )((void *)0)) {
9124     TIFFError("extractContigSamplesShifted8bits",   9124     TIFFError("extractContigSamplesShifted8bits",
9125               "Invalid input or output buffer");   9125               "Invalid input or output buffer");
9126     return (1);   9126     return (1);
9127   } else {   9127   } else {
9128     9128  
9129   }   9129   }
9130   if (start > end) {   9130   if (start > end) {
9131     TIFFError("extractContigSamplesShifted8bits",   9131     TIFFError("extractContigSamplesShifted8bits",
9132               "Invalid start column value %d ignored", start);   9132               "Invalid start column value %d ignored", start);
9133     start = (uint32 )0;   9133     start = (uint32 )0;
9134   } else   9134   } else
9135   if (start > cols) {   9135   if (start > cols) {
9136     TIFFError("extractContigSamplesShifted8bits",   9136     TIFFError("extractContigSamplesShifted8bits",
9137               "Invalid start column value %d ignored", start);   9137               "Invalid start column value %d ignored", start);
9138     start = (uint32 )0;   9138     start = (uint32 )0;
9139   } else {   9139   } else {
9140     9140  
9141   }   9141   }
9142   if (end == 0U) {   9142   if (end == 0U) {
9143     TIFFError("extractContigSamplesShifted8bits",   9143     TIFFError("extractContigSamplesShifted8bits",
9144               "Invalid end column value %d ignored", end);   9144               "Invalid end column value %d ignored", end);
9145     end = cols;   9145     end = cols;
9146   } else   9146   } else
9147   if (end > cols) {   9147   if (end > cols) {
9148     TIFFError("extractContigSamplesShifted8bits",   9148     TIFFError("extractContigSamplesShifted8bits",
9149               "Invalid end column value %d ignored", end);   9149               "Invalid end column value %d ignored", end);
9150     end = cols;   9150     end = cols;
9151   } else {   9151   } else {
9152     9152  
9153   }   9153   }
9154   ready_bits = shift;   9154   ready_bits = shift;
9155   maskbits = (uint8 )(255 >> (8 - (int )bps));   9155   maskbits = (uint8 )(255 >> (8 - (int )bps));
9156   buff2 = (uint8 )0;   9156   buff2 = (uint8 )0;
9157   buff1 = buff2;   9157   buff1 = buff2;
9158   col = start;   9158   col = start;
9159   while (col < end) {   9159   while (col < end) {
9160     bit_offset = (col * (uint32 )bps) * (uint32 )spp;   9160     bit_offset = (col * (uint32 )bps) * (uint32 )spp;
9161     sindex = (int )sample;   9161     sindex = (int )sample;
9162     while (1) {   9162     while (1) {
9163       if (sindex < (int )spp) {   9163       if (sindex < (int )spp) {
9164         if (sindex < (int )sample + (int )count) {   9164         if (sindex < (int )sample + (int )count) {
9165     9165  
9166         } else {   9166         } else {
9167           break;   9167           break;
9168         }   9168         }
9169       } else {   9169       } else {
9170         break;   9170         break;
9171       }   9171       }
9172       if (sindex == 0) {   9172       if (sindex == 0) {
9173         src_byte = bit_offset / 8U;   9173         src_byte = bit_offset / 8U;
9174         src_bit = bit_offset % 8U;   9174         src_bit = bit_offset % 8U;
9175       } else {   9175       } else {
9176         src_byte = (bit_offset + (uint32 )(sindex * (int )bps)) / 8U;   9176         src_byte = (bit_offset + (uint32 )(sindex * (int )bps)) / 8U;
9177         src_bit = (bit_offset + (uint32 )(sindex * (int )bps)) % 8U;   9177         src_bit = (bit_offset + (uint32 )(sindex * (int )bps)) % 8U;
9178       }   9178       }
9179       src = in + src_byte;   9179       src = in + src_byte;
9180       matchbits = (uint8 )((int )maskbits << ((8U - src_bit) - (uint32 )bps));   9180       matchbits = (uint8 )((int )maskbits << ((8U - src_bit) - (uint32 )bps));
9181       buff1 = (uint8 )(((int )*src & (int )matchbits) << src_bit);   9181       buff1 = (uint8 )(((int )*src & (int )matchbits) << src_bit);
9182       if (col == start) {   9182       if (col == start) {
9183         if (sindex == (int )sample) {   9183         if (sindex == (int )sample) {
9184           buff2 = (uint8 )((int )*src & (255 << shift));   9184           buff2 = (uint8 )((int )*src & (255 << shift));
9185         } else {   9185         } else {
9186     9186  
9187         }   9187         }
9188       } else {   9188       } else {
9189     9189  
9190       }   9190       }
9191       if (ready_bits >= 8) {   9191       if (ready_bits >= 8) {
9192         tmp = dst;   9192         tmp = dst;
9193         dst ++;   9193         dst ++;
9194         *tmp = (uint8 )((int )*tmp | (int )buff2);   9194         *tmp = (uint8 )((int )*tmp | (int )buff2);
9195         buff2 = buff1;   9195         buff2 = buff1;
9196         ready_bits -= 8;   9196         ready_bits -= 8;
9197       } else {   9197       } else {
9198         buff2 = (uint8 )((int )buff2 | ((int )buff1 >> ready_bits));   9198         buff2 = (uint8 )((int )buff2 | ((int )buff1 >> ready_bits));
9199       }   9199       }
9200       ready_bits += (int )bps;   9200       ready_bits += (int )bps;
9201       sindex ++;   9201       sindex ++;
9202     }   9202     }
9203     col ++;   9203     col ++;
9204   }   9204   }
9205   while (ready_bits > 0) {   9205   while (ready_bits > 0) {
9206     buff1 = (uint8 )((unsigned int )buff2 & (255U << (8 - ready_bits)));   9206     buff1 = (uint8 )((unsigned int )buff2 & (255U << (8 - ready_bits)));
9207     tmp___0 = dst;   9207     tmp___0 = dst;
9208     dst ++;   9208     dst ++;
9209     *tmp___0 = buff1;   9209     *tmp___0 = buff1;
9210     ready_bits -= 8;   9210     ready_bits -= 8;
9211   }   9211   }
9212   return (0);   9212   return (0);
9213 }   9213 }
9214 }   9214 }
9215 static int extractContigSamplesShifted16bits(uint8 *in , uint8 *out ,   9215 static int extractContigSamplesShifted16bits(uint8 *in , uint8 *out ,
9216                                              uint32 cols , tsample_t sample ,   9216                                              uint32 cols , tsample_t sample ,
9217                                              uint16 spp , uint16 bps ,   9217                                              uint16 spp , uint16 bps ,
9218                                              tsample_t count , uint32 start ,   9218                                              tsample_t count , uint32 start ,
9219                                              uint32 end , int shift )   9219                                              uint32 end , int shift )
9220 {   9220 {
9221   int ready_bits ;   9221   int ready_bits ;
9222   int sindex ;   9222   int sindex ;
9223   uint32 col ;   9223   uint32 col ;
9224   uint32 src_byte ;   9224   uint32 src_byte ;
9225   uint32 src_bit ;   9225   uint32 src_bit ;
9226   uint32 bit_offset ;   9226   uint32 bit_offset ;
9227   uint16 maskbits ;   9227   uint16 maskbits ;
9228   uint16 matchbits ;   9228   uint16 matchbits ;
9229   uint16 buff1 ;   9229   uint16 buff1 ;
9230   uint16 buff2 ;   9230   uint16 buff2 ;
9231   uint8 bytebuff ;   9231   uint8 bytebuff ;
9232   uint8 *src ;   9232   uint8 *src ;
9233   uint8 *dst ;   9233   uint8 *dst ;
9234   unsigned char swapbuff[2] ;   9234   unsigned char swapbuff[2] ;
9235   uint8 *tmp ;   9235   uint8 *tmp ;
9236   uint8 *tmp___0 ;   9236   uint8 *tmp___0 ;
9237     9237  
9238   {   9238   {
9239   ready_bits = 0;   9239   ready_bits = 0;
9240   sindex = 0;   9240   sindex = 0;
9241   maskbits = (uint16 )0;   9241   maskbits = (uint16 )0;
9242   matchbits = (uint16 )0;   9242   matchbits = (uint16 )0;
9243   buff1 = (uint16 )0;   9243   buff1 = (uint16 )0;
9244   buff2 = (uint16 )0;   9244   buff2 = (uint16 )0;
9245   bytebuff = (uint8 )0;   9245   bytebuff = (uint8 )0;
9246   src = in;   9246   src = in;
9247   dst = out;   9247   dst = out;
9248   if ((unsigned int )src == (unsigned int )((void *)0)) {   9248   if ((unsigned int )src == (unsigned int )((void *)0)) {
9249     TIFFError("extractContigSamplesShifted16bits",   9249     TIFFError("extractContigSamplesShifted16bits",
9250               "Invalid input or output buffer");   9250               "Invalid input or output buffer");
9251     return (1);   9251     return (1);
9252   } else   9252   } else
9253   if ((unsigned int )dst == (unsigned int )((void *)0)) {   9253   if ((unsigned int )dst == (unsigned int )((void *)0)) {
9254     TIFFError("extractContigSamplesShifted16bits",   9254     TIFFError("extractContigSamplesShifted16bits",
9255               "Invalid input or output buffer");   9255               "Invalid input or output buffer");
9256     return (1);   9256     return (1);
9257   } else {   9257   } else {
9258     9258  
9259   }   9259   }
9260   if (start > end) {   9260   if (start > end) {
9261     TIFFError("extractContigSamplesShifted16bits",   9261     TIFFError("extractContigSamplesShifted16bits",
9262               "Invalid start column value %d ignored", start);   9262               "Invalid start column value %d ignored", start);
9263     start = (uint32 )0;   9263     start = (uint32 )0;
9264   } else   9264   } else
9265   if (start > cols) {   9265   if (start > cols) {
9266     TIFFError("extractContigSamplesShifted16bits",   9266     TIFFError("extractContigSamplesShifted16bits",
9267               "Invalid start column value %d ignored", start);   9267               "Invalid start column value %d ignored", start);
9268     start = (uint32 )0;   9268     start = (uint32 )0;
9269   } else {   9269   } else {
9270     9270  
9271   }   9271   }
9272   if (end == 0U) {   9272   if (end == 0U) {
9273     TIFFError("extractContigSamplesShifted16bits",   9273     TIFFError("extractContigSamplesShifted16bits",
9274               "Invalid end column value %d ignored", end);   9274               "Invalid end column value %d ignored", end);
9275     end = cols;   9275     end = cols;
9276   } else   9276   } else
9277   if (end > cols) {   9277   if (end > cols) {
9278     TIFFError("extractContigSamplesShifted16bits",   9278     TIFFError("extractContigSamplesShifted16bits",
9279               "Invalid end column value %d ignored", end);   9279               "Invalid end column value %d ignored", end);
9280     end = cols;   9280     end = cols;
9281   } else {   9281   } else {
9282     9282  
9283   }   9283   }
9284   ready_bits = shift;   9284   ready_bits = shift;
9285   maskbits = (uint16 )(65535 >> (16 - (int )bps));   9285   maskbits = (uint16 )(65535 >> (16 - (int )bps));
9286   col = start;   9286   col = start;
9287   while (col < end) {   9287   while (col < end) {
9288     bit_offset = (col * (uint32 )bps) * (uint32 )spp;   9288     bit_offset = (col * (uint32 )bps) * (uint32 )spp;
9289     sindex = (int )sample;   9289     sindex = (int )sample;
9290     while (1) {   9290     while (1) {
9291       if (sindex < (int )spp) {   9291       if (sindex < (int )spp) {
9292         if (sindex < (int )sample + (int )count) {   9292         if (sindex < (int )sample + (int )count) {
9293     9293  
9294         } else {   9294         } else {
9295           break;   9295           break;
9296         }   9296         }
9297       } else {   9297       } else {
9298         break;   9298         break;
9299       }   9299       }
9300       if (sindex == 0) {   9300       if (sindex == 0) {
9301         src_byte = bit_offset / 8U;   9301         src_byte = bit_offset / 8U;
9302         src_bit = bit_offset % 8U;   9302         src_bit = bit_offset % 8U;
9303       } else {   9303       } else {
9304         src_byte = (bit_offset + (uint32 )(sindex * (int )bps)) / 8U;   9304         src_byte = (bit_offset + (uint32 )(sindex * (int )bps)) / 8U;
9305         src_bit = (bit_offset + (uint32 )(sindex * (int )bps)) % 8U;   9305         src_bit = (bit_offset + (uint32 )(sindex * (int )bps)) % 8U;
9306       }   9306       }
9307       src = in + src_byte;   9307       src = in + src_byte;
9308       matchbits = (uint16 )((int )maskbits << ((16U - src_bit) - (uint32 )bps));   9308       matchbits = (uint16 )((int )maskbits << ((16U - src_bit) - (uint32 )bps));
9309       if (little_endian) {   9309       if (little_endian) {
9310         swapbuff[1] = *src;   9310         swapbuff[1] = *src;
9311         swapbuff[0] = *(src + 1);   9311         swapbuff[0] = *(src + 1);
9312       } else {   9312       } else {
9313         swapbuff[0] = *src;   9313         swapbuff[0] = *src;
9314         swapbuff[1] = *(src + 1);   9314         swapbuff[1] = *(src + 1);
9315       }   9315       }
9316       buff1 = *((uint16 *)(swapbuff));   9316       buff1 = *((uint16 *)(swapbuff));
9317       if (col == start) {   9317       if (col == start) {
9318         if (sindex == (int )sample) {   9318         if (sindex == (int )sample) {
9319           buff2 = (uint16 )((int )buff1 & (65535 << (8 - shift)));   9319           buff2 = (uint16 )((int )buff1 & (65535 << (8 - shift)));
9320         } else {   9320         } else {
9321     9321  
9322         }   9322         }
9323       } else {   9323       } else {
9324     9324  
9325       }   9325       }
9326       buff1 = (uint16 )(((int )buff1 & (int )matchbits) << src_bit);   9326       buff1 = (uint16 )(((int )buff1 & (int )matchbits) << src_bit);
9327       if (ready_bits < 8) {   9327       if (ready_bits < 8) {
9328         buff2 = (uint16 )((int )buff2 | ((int )buff1 >> ready_bits));   9328         buff2 = (uint16 )((int )buff2 | ((int )buff1 >> ready_bits));
9329       } else {   9329       } else {
9330         bytebuff = (uint8 )((int )buff2 >> 8);   9330         bytebuff = (uint8 )((int )buff2 >> 8);
9331         tmp = dst;   9331         tmp = dst;
9332         dst ++;   9332         dst ++;
9333         *tmp = bytebuff;   9333         *tmp = bytebuff;
9334         ready_bits -= 8;   9334         ready_bits -= 8;
9335         buff2 = (uint16 )(((int )buff2 << 8) | ((int )buff1 >> ready_bits));   9335         buff2 = (uint16 )(((int )buff2 << 8) | ((int )buff1 >> ready_bits));
9336       }   9336       }
9337       ready_bits += (int )bps;   9337       ready_bits += (int )bps;
9338       sindex ++;   9338       sindex ++;
9339     }   9339     }
9340     col ++;   9340     col ++;
9341   }   9341   }
9342   while (ready_bits > 0) {   9342   while (ready_bits > 0) {
9343     bytebuff = (uint8 )((int )buff2 >> 8);   9343     bytebuff = (uint8 )((int )buff2 >> 8);
9344     tmp___0 = dst;   9344     tmp___0 = dst;
9345     dst ++;   9345     dst ++;
9346     *tmp___0 = bytebuff;   9346     *tmp___0 = bytebuff;
9347     ready_bits -= 8;   9347     ready_bits -= 8;
9348   }   9348   }
9349   return (0);   9349   return (0);
9350 }   9350 }
9351 }   9351 }
9352 static int extractContigSamplesShifted24bits(uint8 *in , uint8 *out ,   9352 static int extractContigSamplesShifted24bits(uint8 *in , uint8 *out ,
9353                                              uint32 cols , tsample_t sample ,   9353                                              uint32 cols , tsample_t sample ,
9354                                              uint16 spp , uint16 bps ,   9354                                              uint16 spp , uint16 bps ,
9355                                              tsample_t count , uint32 start ,   9355                                              tsample_t count , uint32 start ,
9356                                              uint32 end , int shift )   9356                                              uint32 end , int shift )
9357 {   9357 {
9358   int ready_bits ;   9358   int ready_bits ;
9359   int sindex ;   9359   int sindex ;
9360   uint32 col ;   9360   uint32 col ;
9361   uint32 src_byte ;   9361   uint32 src_byte ;
9362   uint32 src_bit ;   9362   uint32 src_bit ;
9363   uint32 bit_offset ;   9363   uint32 bit_offset ;
9364   uint32 maskbits ;   9364   uint32 maskbits ;
9365   uint32 matchbits ;   9365   uint32 matchbits ;
9366   uint32 buff1 ;   9366   uint32 buff1 ;
9367   uint32 buff2 ;   9367   uint32 buff2 ;
9368   uint8 bytebuff1 ;   9368   uint8 bytebuff1 ;
9369   uint8 bytebuff2 ;   9369   uint8 bytebuff2 ;
9370   uint8 *src ;   9370   uint8 *src ;
9371   uint8 *dst ;   9371   uint8 *dst ;
9372   unsigned char swapbuff[4] ;   9372   unsigned char swapbuff[4] ;
9373   uint8 *tmp ;   9373   uint8 *tmp ;
9374   uint8 *tmp___0 ;   9374   uint8 *tmp___0 ;
9375   uint8 *tmp___1 ;   9375   uint8 *tmp___1 ;
9376     9376  
9377   {   9377   {
9378   ready_bits = 0;   9378   ready_bits = 0;
9379   sindex = 0;   9379   sindex = 0;
9380   maskbits = (uint32 )0;   9380   maskbits = (uint32 )0;
9381   matchbits = (uint32 )0;   9381   matchbits = (uint32 )0;
9382   buff1 = (uint32 )0;   9382   buff1 = (uint32 )0;
9383   buff2 = (uint32 )0;   9383   buff2 = (uint32 )0;
9384   bytebuff1 = (uint8 )0;   9384   bytebuff1 = (uint8 )0;
9385   bytebuff2 = (uint8 )0;   9385   bytebuff2 = (uint8 )0;
9386   src = in;   9386   src = in;
9387   dst = out;   9387   dst = out;
9388   if ((unsigned int )in == (unsigned int )((void *)0)) {   9388   if ((unsigned int )in == (unsigned int )((void *)0)) {
9389     TIFFError("extractContigSamplesShifted24bits",   9389     TIFFError("extractContigSamplesShifted24bits",
9390               "Invalid input or output buffer");   9390               "Invalid input or output buffer");
9391     return (1);   9391     return (1);
9392   } else   9392   } else
9393   if ((unsigned int )out == (unsigned int )((void *)0)) {   9393   if ((unsigned int )out == (unsigned int )((void *)0)) {
9394     TIFFError("extractContigSamplesShifted24bits",   9394     TIFFError("extractContigSamplesShifted24bits",
9395               "Invalid input or output buffer");   9395               "Invalid input or output buffer");
9396     return (1);   9396     return (1);
9397   } else {   9397   } else {
9398     9398  
9399   }   9399   }
9400   if (start > end) {   9400   if (start > end) {
9401     TIFFError("extractContigSamplesShifted24bits",   9401     TIFFError("extractContigSamplesShifted24bits",
9402               "Invalid start column value %d ignored", start);   9402               "Invalid start column value %d ignored", start);
9403     start = (uint32 )0;   9403     start = (uint32 )0;
9404   } else   9404   } else
9405   if (start > cols) {   9405   if (start > cols) {
9406     TIFFError("extractContigSamplesShifted24bits",   9406     TIFFError("extractContigSamplesShifted24bits",
9407               "Invalid start column value %d ignored", start);   9407               "Invalid start column value %d ignored", start);
9408     start = (uint32 )0;   9408     start = (uint32 )0;
9409   } else {   9409   } else {
9410     9410  
9411   }   9411   }
9412   if (end == 0U) {   9412   if (end == 0U) {
9413     TIFFError("extractContigSamplesShifted24bits",   9413     TIFFError("extractContigSamplesShifted24bits",
9414               "Invalid end column value %d ignored", end);   9414               "Invalid end column value %d ignored", end);
9415     end = cols;   9415     end = cols;
9416   } else   9416   } else
9417   if (end > cols) {   9417   if (end > cols) {
9418     TIFFError("extractContigSamplesShifted24bits",   9418     TIFFError("extractContigSamplesShifted24bits",
9419               "Invalid end column value %d ignored", end);   9419               "Invalid end column value %d ignored", end);
9420     end = cols;   9420     end = cols;
9421   } else {   9421   } else {
9422     9422  
9423   }   9423   }
9424   ready_bits = shift;   9424   ready_bits = shift;
9425   maskbits = 4294967295U >> (32 - (int )bps);   9425   maskbits = 4294967295U >> (32 - (int )bps);
9426   col = start;   9426   col = start;
9427   while (col < end) {   9427   while (col < end) {
9428     bit_offset = (col * (uint32 )bps) * (uint32 )spp;   9428     bit_offset = (col * (uint32 )bps) * (uint32 )spp;
9429     sindex = (int )sample;   9429     sindex = (int )sample;
9430     while (1) {   9430     while (1) {
9431       if (sindex < (int )spp) {   9431       if (sindex < (int )spp) {
9432         if (sindex < (int )sample + (int )count) {   9432         if (sindex < (int )sample + (int )count) {
9433     9433  
9434         } else {   9434         } else {
9435           break;   9435           break;
9436         }   9436         }
9437       } else {   9437       } else {
9438         break;   9438         break;
9439       }   9439       }
9440       if (sindex == 0) {   9440       if (sindex == 0) {
9441         src_byte = bit_offset / 8U;   9441         src_byte = bit_offset / 8U;
9442         src_bit = bit_offset % 8U;   9442         src_bit = bit_offset % 8U;
9443       } else {   9443       } else {
9444         src_byte = (bit_offset + (uint32 )(sindex * (int )bps)) / 8U;   9444         src_byte = (bit_offset + (uint32 )(sindex * (int )bps)) / 8U;
9445         src_bit = (bit_offset + (uint32 )(sindex * (int )bps)) % 8U;   9445         src_bit = (bit_offset + (uint32 )(sindex * (int )bps)) % 8U;
9446       }   9446       }
9447       src = in + src_byte;   9447       src = in + src_byte;
9448       matchbits = maskbits << ((32U - src_bit) - (uint32 )bps);   9448       matchbits = maskbits << ((32U - src_bit) - (uint32 )bps);
9449       if (little_endian) {   9449       if (little_endian) {
9450         swapbuff[3] = *src;   9450         swapbuff[3] = *src;
9451         swapbuff[2] = *(src + 1);   9451         swapbuff[2] = *(src + 1);
9452         swapbuff[1] = *(src + 2);   9452         swapbuff[1] = *(src + 2);
9453         swapbuff[0] = *(src + 3);   9453         swapbuff[0] = *(src + 3);
9454       } else {   9454       } else {
9455         swapbuff[0] = *src;   9455         swapbuff[0] = *src;
9456         swapbuff[1] = *(src + 1);   9456         swapbuff[1] = *(src + 1);
9457         swapbuff[2] = *(src + 2);   9457         swapbuff[2] = *(src + 2);
9458         swapbuff[3] = *(src + 3);   9458         swapbuff[3] = *(src + 3);
9459       }   9459       }
9460       buff1 = *((uint32 *)(swapbuff));   9460       buff1 = *((uint32 *)(swapbuff));
9461       if (col == start) {   9461       if (col == start) {
9462         if (sindex == (int )sample) {   9462         if (sindex == (int )sample) {
9463           buff2 = buff1 & (4294967295U << (16 - shift));   9463           buff2 = buff1 & (4294967295U << (16 - shift));
9464         } else {   9464         } else {
9465     9465  
9466         }   9466         }
9467       } else {   9467       } else {
9468     9468  
9469       }   9469       }
9470       buff1 = (buff1 & matchbits) << src_bit;   9470       buff1 = (buff1 & matchbits) << src_bit;
9471       if (ready_bits < 16) {   9471       if (ready_bits < 16) {
9472         bytebuff2 = (uint8 )0;   9472         bytebuff2 = (uint8 )0;
9473         bytebuff1 = bytebuff2;   9473         bytebuff1 = bytebuff2;
9474         buff2 |= buff1 >> ready_bits;   9474         buff2 |= buff1 >> ready_bits;
9475       } else {   9475       } else {
9476         bytebuff1 = (uint8 )(buff2 >> 24);   9476         bytebuff1 = (uint8 )(buff2 >> 24);
9477         tmp = dst;   9477         tmp = dst;
9478         dst ++;   9478         dst ++;
9479         *tmp = bytebuff1;   9479         *tmp = bytebuff1;
9480         bytebuff2 = (uint8 )(buff2 >> 16);   9480         bytebuff2 = (uint8 )(buff2 >> 16);
9481         tmp___0 = dst;   9481         tmp___0 = dst;
9482         dst ++;   9482         dst ++;
9483         *tmp___0 = bytebuff2;   9483         *tmp___0 = bytebuff2;
9484         ready_bits -= 16;   9484         ready_bits -= 16;
9485         buff2 = (buff2 << 16) | (buff1 >> ready_bits);   9485         buff2 = (buff2 << 16) | (buff1 >> ready_bits);
9486       }   9486       }
9487       ready_bits += (int )bps;   9487       ready_bits += (int )bps;
9488       sindex ++;   9488       sindex ++;
9489     }   9489     }
9490     col ++;   9490     col ++;
9491   }   9491   }
9492   while (ready_bits > 0) {   9492   while (ready_bits > 0) {
9493     bytebuff1 = (uint8 )(buff2 >> 24);   9493     bytebuff1 = (uint8 )(buff2 >> 24);
9494     tmp___1 = dst;   9494     tmp___1 = dst;
9495     dst ++;   9495     dst ++;
9496     *tmp___1 = bytebuff1;   9496     *tmp___1 = bytebuff1;
9497     buff2 <<= 8;   9497     buff2 <<= 8;
9498     bytebuff2 = bytebuff1;   9498     bytebuff2 = bytebuff1;
9499     ready_bits -= 8;   9499     ready_bits -= 8;
9500   }   9500   }
9501   return (0);   9501   return (0);
9502 }   9502 }
9503 }   9503 }
9504 static int extractContigSamplesShifted32bits(uint8 *in , uint8 *out ,   9504 static int extractContigSamplesShifted32bits(uint8 *in , uint8 *out ,
9505                                              uint32 cols , tsample_t sample ,   9505                                              uint32 cols , tsample_t sample ,
9506                                              uint16 spp , uint16 bps ,   9506                                              uint16 spp , uint16 bps ,
9507                                              tsample_t count , uint32 start ,   9507                                              tsample_t count , uint32 start ,
9508                                              uint32 end , int shift )   9508                                              uint32 end , int shift )
9509 {   9509 {
9510   int ready_bits ;   9510   int ready_bits ;
9511   int sindex ;   9511   int sindex ;
9512   int shift_width ;   9512   int shift_width ;
9513   uint32 col ;   9513   uint32 col ;
9514   uint32 src_byte ;   9514   uint32 src_byte ;
9515   uint32 src_bit ;   9515   uint32 src_bit ;
9516   uint32 bit_offset ;   9516   uint32 bit_offset ;
9517   uint32 longbuff1 ;   9517   uint32 longbuff1 ;
9518   uint32 longbuff2 ;   9518   uint32 longbuff2 ;
9519   uint64 maskbits ;   9519   uint64 maskbits ;
9520   uint64 matchbits ;   9520   uint64 matchbits ;
9521   uint64 buff1 ;   9521   uint64 buff1 ;
9522   uint64 buff2 ;   9522   uint64 buff2 ;
9523   uint64 buff3 ;   9523   uint64 buff3 ;
9524   uint8 bytebuff1 ;   9524   uint8 bytebuff1 ;
9525   uint8 bytebuff2 ;   9525   uint8 bytebuff2 ;
9526   uint8 bytebuff3 ;   9526   uint8 bytebuff3 ;
9527   uint8 bytebuff4 ;   9527   uint8 bytebuff4 ;
9528   uint8 *src ;   9528   uint8 *src ;
9529   uint8 *dst ;   9529   uint8 *dst ;
9530   unsigned char swapbuff1[4] ;   9530   unsigned char swapbuff1[4] ;
9531   unsigned char swapbuff2[4] ;   9531   unsigned char swapbuff2[4] ;
9532   uint8 *tmp ;   9532   uint8 *tmp ;
9533   uint8 *tmp___0 ;   9533   uint8 *tmp___0 ;
9534   uint8 *tmp___1 ;   9534   uint8 *tmp___1 ;
9535   uint8 *tmp___2 ;   9535   uint8 *tmp___2 ;
9536   uint8 *tmp___3 ;   9536   uint8 *tmp___3 ;
9537     9537  
9538   {   9538   {
9539   ready_bits = 0;   9539   ready_bits = 0;
9540   sindex = 0;   9540   sindex = 0;
9541   shift_width = 0;   9541   shift_width = 0;
9542   longbuff1 = (uint32 )0;   9542   longbuff1 = (uint32 )0;
9543   longbuff2 = (uint32 )0;   9543   longbuff2 = (uint32 )0;
9544   maskbits = (uint64 )0;   9544   maskbits = (uint64 )0;
9545   matchbits = (uint64 )0;   9545   matchbits = (uint64 )0;
9546   buff1 = (uint64 )0;   9546   buff1 = (uint64 )0;
9547   buff2 = (uint64 )0;   9547   buff2 = (uint64 )0;
9548   buff3 = (uint64 )0;   9548   buff3 = (uint64 )0;
9549   bytebuff1 = (uint8 )0;   9549   bytebuff1 = (uint8 )0;
9550   bytebuff2 = (uint8 )0;   9550   bytebuff2 = (uint8 )0;
9551   bytebuff3 = (uint8 )0;   9551   bytebuff3 = (uint8 )0;
9552   bytebuff4 = (uint8 )0;   9552   bytebuff4 = (uint8 )0;
9553   src = in;   9553   src = in;
9554   dst = out;   9554   dst = out;
9555   if ((unsigned int )in == (unsigned int )((void *)0)) {   9555   if ((unsigned int )in == (unsigned int )((void *)0)) {
9556     TIFFError("extractContigSamplesShifted32bits",   9556     TIFFError("extractContigSamplesShifted32bits",
9557               "Invalid input or output buffer");   9557               "Invalid input or output buffer");
9558     return (1);   9558     return (1);
9559   } else   9559   } else
9560   if ((unsigned int )out == (unsigned int )((void *)0)) {   9560   if ((unsigned int )out == (unsigned int )((void *)0)) {
9561     TIFFError("extractContigSamplesShifted32bits",   9561     TIFFError("extractContigSamplesShifted32bits",
9562               "Invalid input or output buffer");   9562               "Invalid input or output buffer");
9563     return (1);   9563     return (1);
9564   } else {   9564   } else {
9565     9565  
9566   }   9566   }
9567   if (start > end) {   9567   if (start > end) {
9568     TIFFError("extractContigSamplesShifted32bits",   9568     TIFFError("extractContigSamplesShifted32bits",
9569               "Invalid start column value %d ignored", start);   9569               "Invalid start column value %d ignored", start);
9570     start = (uint32 )0;   9570     start = (uint32 )0;
9571   } else   9571   } else
9572   if (start > cols) {   9572   if (start > cols) {
9573     TIFFError("extractContigSamplesShifted32bits",   9573     TIFFError("extractContigSamplesShifted32bits",
9574               "Invalid start column value %d ignored", start);   9574               "Invalid start column value %d ignored", start);
9575     start = (uint32 )0;   9575     start = (uint32 )0;
9576   } else {   9576   } else {
9577     9577  
9578   }   9578   }
9579   if (end == 0U) {   9579   if (end == 0U) {
9580     TIFFError("extractContigSamplesShifted32bits",   9580     TIFFError("extractContigSamplesShifted32bits",
9581               "Invalid end column value %d ignored", end);   9581               "Invalid end column value %d ignored", end);
9582     end = cols;   9582     end = cols;
9583   } else   9583   } else
9584   if (end > cols) {   9584   if (end > cols) {
9585     TIFFError("extractContigSamplesShifted32bits",   9585     TIFFError("extractContigSamplesShifted32bits",
9586               "Invalid end column value %d ignored", end);   9586               "Invalid end column value %d ignored", end);
9587     end = cols;   9587     end = cols;
9588   } else {   9588   } else {
9589     9589  
9590   }   9590   }
9591   shift_width = ((int )bps + 7) / 8 + 1;   9591   shift_width = ((int )bps + 7) / 8 + 1;
9592   ready_bits = shift;   9592   ready_bits = shift;
9593   maskbits = 0xffffffffffffffffULL >> (64 - (int )bps);   9593   maskbits = 0xffffffffffffffffULL >> (64 - (int )bps);
9594   col = start;   9594   col = start;
9595   while (col < end) {   9595   while (col < end) {
9596     bit_offset = (col * (uint32 )bps) * (uint32 )spp;   9596     bit_offset = (col * (uint32 )bps) * (uint32 )spp;
9597     sindex = (int )sample;   9597     sindex = (int )sample;
9598     while (1) {   9598     while (1) {
9599       if (sindex < (int )spp) {   9599       if (sindex < (int )spp) {
9600         if (sindex < (int )sample + (int )count) {   9600         if (sindex < (int )sample + (int )count) {
9601     9601  
9602         } else {   9602         } else {
9603           break;   9603           break;
9604         }   9604         }
9605       } else {   9605       } else {
9606         break;   9606         break;
9607       }   9607       }
9608       if (sindex == 0) {   9608       if (sindex == 0) {
9609         src_byte = bit_offset / 8U;   9609         src_byte = bit_offset / 8U;
9610         src_bit = bit_offset % 8U;   9610         src_bit = bit_offset % 8U;
9611       } else {   9611       } else {
9612         src_byte = (bit_offset + (uint32 )(sindex * (int )bps)) / 8U;   9612         src_byte = (bit_offset + (uint32 )(sindex * (int )bps)) / 8U;
9613         src_bit = (bit_offset + (uint32 )(sindex * (int )bps)) % 8U;   9613         src_bit = (bit_offset + (uint32 )(sindex * (int )bps)) % 8U;
9614       }   9614       }
9615       src = in + src_byte;   9615       src = in + src_byte;
9616       matchbits = maskbits << ((64U - src_bit) - (uint32 )bps);   9616       matchbits = maskbits << ((64U - src_bit) - (uint32 )bps);
9617       if (little_endian) {   9617       if (little_endian) {
9618         swapbuff1[3] = *src;   9618         swapbuff1[3] = *src;
9619         swapbuff1[2] = *(src + 1);   9619         swapbuff1[2] = *(src + 1);
9620         swapbuff1[1] = *(src + 2);   9620         swapbuff1[1] = *(src + 2);
9621         swapbuff1[0] = *(src + 3);   9621         swapbuff1[0] = *(src + 3);
9622       } else {   9622       } else {
9623         swapbuff1[0] = *src;   9623         swapbuff1[0] = *src;
9624         swapbuff1[1] = *(src + 1);   9624         swapbuff1[1] = *(src + 1);
9625         swapbuff1[2] = *(src + 2);   9625         swapbuff1[2] = *(src + 2);
9626         swapbuff1[3] = *(src + 3);   9626         swapbuff1[3] = *(src + 3);
9627       }   9627       }
9628       longbuff1 = *((uint32 *)(swapbuff1));   9628       longbuff1 = *((uint32 *)(swapbuff1));
9629       memset((void *)(swapbuff2), '\000', sizeof(swapbuff2));   9629       memset((void *)(swapbuff2), '\000', sizeof(swapbuff2));
9630       if (little_endian) {   9630       if (little_endian) {
9631         swapbuff2[3] = *src;   9631         swapbuff2[3] = *src;
9632         swapbuff2[2] = *(src + 1);   9632         swapbuff2[2] = *(src + 1);
9633         swapbuff2[1] = *(src + 2);   9633         swapbuff2[1] = *(src + 2);
9634         swapbuff2[0] = *(src + 3);   9634         swapbuff2[0] = *(src + 3);
9635       } else {   9635       } else {
9636         swapbuff2[0] = *src;   9636         swapbuff2[0] = *src;
9637         swapbuff2[1] = *(src + 1);   9637         swapbuff2[1] = *(src + 1);
9638         swapbuff2[2] = *(src + 2);   9638         swapbuff2[2] = *(src + 2);
9639         swapbuff2[3] = *(src + 3);   9639         swapbuff2[3] = *(src + 3);
9640       }   9640       }
9641       longbuff2 = *((uint32 *)(swapbuff2));   9641       longbuff2 = *((uint32 *)(swapbuff2));
9642       buff3 = ((uint64 )longbuff1 << 32) | (unsigned long long )longbuff2;   9642       buff3 = ((uint64 )longbuff1 << 32) | (unsigned long long )longbuff2;
9643       if (col == start) {   9643       if (col == start) {
9644         if (sindex == (int )sample) {   9644         if (sindex == (int )sample) {
9645           buff2 = buff3 & (0xffffffffffffffffULL << (32 - shift));   9645           buff2 = buff3 & (0xffffffffffffffffULL << (32 - shift));
9646         } else {   9646         } else {
9647     9647  
9648         }   9648         }
9649       } else {   9649       } else {
9650     9650  
9651       }   9651       }
9652       buff1 = (buff3 & matchbits) << src_bit;   9652       buff1 = (buff3 & matchbits) << src_bit;
9653       if (ready_bits < 32) {   9653       if (ready_bits < 32) {
9654         bytebuff4 = (uint8 )0;   9654         bytebuff4 = (uint8 )0;
9655         bytebuff3 = bytebuff4;   9655         bytebuff3 = bytebuff4;
9656         bytebuff2 = bytebuff3;   9656         bytebuff2 = bytebuff3;
9657         bytebuff1 = bytebuff2;   9657         bytebuff1 = bytebuff2;
9658         buff2 |= buff1 >> ready_bits;   9658         buff2 |= buff1 >> ready_bits;
9659       } else {   9659       } else {
9660         bytebuff1 = (uint8 )(buff2 >> 56);   9660         bytebuff1 = (uint8 )(buff2 >> 56);
9661         tmp = dst;   9661         tmp = dst;
9662         dst ++;   9662         dst ++;
9663         *tmp = bytebuff1;   9663         *tmp = bytebuff1;
9664         bytebuff2 = (uint8 )(buff2 >> 48);   9664         bytebuff2 = (uint8 )(buff2 >> 48);
9665         tmp___0 = dst;   9665         tmp___0 = dst;
9666         dst ++;   9666         dst ++;
9667         *tmp___0 = bytebuff2;   9667         *tmp___0 = bytebuff2;
9668         bytebuff3 = (uint8 )(buff2 >> 40);   9668         bytebuff3 = (uint8 )(buff2 >> 40);
9669         tmp___1 = dst;   9669         tmp___1 = dst;
9670         dst ++;   9670         dst ++;
9671         *tmp___1 = bytebuff3;   9671         *tmp___1 = bytebuff3;
9672         bytebuff4 = (uint8 )(buff2 >> 32);   9672         bytebuff4 = (uint8 )(buff2 >> 32);
9673         tmp___2 = dst;   9673         tmp___2 = dst;
9674         dst ++;   9674         dst ++;
9675         *tmp___2 = bytebuff4;   9675         *tmp___2 = bytebuff4;
9676         ready_bits -= 32;   9676         ready_bits -= 32;
9677         buff2 = (buff2 << 32) | (buff1 >> ready_bits);   9677         buff2 = (buff2 << 32) | (buff1 >> ready_bits);
9678       }   9678       }
9679       ready_bits += (int )bps;   9679       ready_bits += (int )bps;
9680       sindex ++;   9680       sindex ++;
9681     }   9681     }
9682     col ++;   9682     col ++;
9683   }   9683   }
9684   while (ready_bits > 0) {   9684   while (ready_bits > 0) {
9685     bytebuff1 = (uint8 )(buff2 >> 56);   9685     bytebuff1 = (uint8 )(buff2 >> 56);
9686     tmp___3 = dst;   9686     tmp___3 = dst;
9687     dst ++;   9687     dst ++;
9688     *tmp___3 = bytebuff1;   9688     *tmp___3 = bytebuff1;
9689     buff2 <<= 8;   9689     buff2 <<= 8;
9690     ready_bits -= 8;   9690     ready_bits -= 8;
9691   }   9691   }
9692   return (0);   9692   return (0);
9693 }   9693 }
9694 }   9694 }
9695 static int extractContigSamplesToBuffer(uint8 *out , uint8 *in , uint32 rows ,   9695 static int extractContigSamplesToBuffer(uint8 *out , uint8 *in , uint32 rows ,
9696                                         uint32 cols , int outskew , int inskew ,   9696                                         uint32 cols , int outskew , int inskew ,
9697                                         tsample_t sample , uint16 spp ,   9697                                         tsample_t sample , uint16 spp ,
9698                                         uint16 bps , struct dump_opts *dump )   9698                                         uint16 bps , struct dump_opts *dump )
9699 {   9699 {
9700   int shift_width ;   9700   int shift_width ;
9701   int bytes_per_sample ;   9701   int bytes_per_sample ;
9702   int bytes_per_pixel ;   9702   int bytes_per_pixel ;
9703   uint32 src_rowsize ;   9703   uint32 src_rowsize ;
9704   uint32 src_offset ;   9704   uint32 src_offset ;
9705   uint32 row ;   9705   uint32 row ;
9706   uint32 first_col ;   9706   uint32 first_col ;
9707   uint32 dst_rowsize ;   9707   uint32 dst_rowsize ;
9708   uint32 dst_offset ;   9708   uint32 dst_offset ;
9709   tsample_t count ;   9709   tsample_t count ;
9710   uint8 *src ;   9710   uint8 *src ;
9711   uint8 *dst ;   9711   uint8 *dst ;
9712   int tmp ;   9712   int tmp ;
9713   int tmp___0 ;   9713   int tmp___0 ;
9714   int tmp___1 ;   9714   int tmp___1 ;
9715   int tmp___2 ;   9715   int tmp___2 ;
9716   int tmp___3 ;   9716   int tmp___3 ;
9717     9717  
9718   {   9718   {
9719   first_col = (uint32 )0;   9719   first_col = (uint32 )0;
9720   count = (tsample_t )1;   9720   count = (tsample_t )1;
9721   bytes_per_sample = ((int )bps + 7) / 8;   9721   bytes_per_sample = ((int )bps + 7) / 8;
9722   bytes_per_pixel = ((int )bps * (int )spp + 7) / 8;   9722   bytes_per_pixel = ((int )bps * (int )spp + 7) / 8;
9723   if ((int )bps % 8 == 0) {   9723   if ((int )bps % 8 == 0) {
9724     shift_width = 0;   9724     shift_width = 0;
9725   } else   9725   } else
9726   if (bytes_per_pixel < bytes_per_sample + 1) {   9726   if (bytes_per_pixel < bytes_per_sample + 1) {
9727     shift_width = bytes_per_pixel;   9727     shift_width = bytes_per_pixel;
9728   } else {   9728   } else {
9729     shift_width = bytes_per_sample + 1;   9729     shift_width = bytes_per_sample + 1;
9730   }   9730   }
9731   src_rowsize = ((uint32 )((int )bps * (int )spp) * cols + 7U) / 8U;   9731   src_rowsize = ((uint32 )((int )bps * (int )spp) * cols + 7U) / 8U;
9732   dst_rowsize = ((uint32 )bps * cols + 7U) / 8U;   9732   dst_rowsize = ((uint32 )bps * cols + 7U) / 8U;
9733   if ((unsigned int )dump->outfile != (unsigned int )((void *)0)) {   9733   if ((unsigned int )dump->outfile != (unsigned int )((void *)0)) {
9734     if (dump->level == 4) {   9734     if (dump->level == 4) {
9735       dump_info(dump->outfile, dump->format,   9735       dump_info(dump->outfile, dump->format,
9736                 (char *)"extractContigSamplesToBuffer",   9736                 (char *)"extractContigSamplesToBuffer",
9737                 (char *)"Sample %d, %d rows", (int )sample + 1, rows + 1U);   9737                 (char *)"Sample %d, %d rows", (int )sample + 1, rows + 1U);
9738     } else {   9738     } else {
9739     9739  
9740     }   9740     }
9741   } else {   9741   } else {
9742     9742  
9743   }   9743   }
9744   row = (uint32 )0;   9744   row = (uint32 )0;
9745   while (row < rows) {   9745   while (row < rows) {
9746     src_offset = row * src_rowsize;   9746     src_offset = row * src_rowsize;
9747     dst_offset = row * dst_rowsize;   9747     dst_offset = row * dst_rowsize;
9748     src = in + src_offset;   9748     src = in + src_offset;
9749     dst = out + dst_offset;   9749     dst = out + dst_offset;
9750     switch (shift_width) {   9750     switch (shift_width) {
9751     case 0:   9751     case 0:
9752     tmp = extractContigSamplesBytes(src, dst, cols, sample, spp, bps, count,   9752     tmp = extractContigSamplesBytes(src, dst, cols, sample, spp, bps, count,
9753                                     first_col, cols);   9753                                     first_col, cols);
9754     if (tmp) {   9754     if (tmp) {
9755       return (1);   9755       return (1);
9756     } else {   9756     } else {
9757     9757  
9758     }   9758     }
9759     break;   9759     break;
9760     case 1:   9760     case 1:
9761     tmp___0 = extractContigSamples8bits(src, dst, cols, sample, spp, bps, count,   9761     tmp___0 = extractContigSamples8bits(src, dst, cols, sample, spp, bps, count,
9762                                         first_col, cols);   9762                                         first_col, cols);
9763     if (tmp___0) {   9763     if (tmp___0) {
9764       return (1);   9764       return (1);
9765     } else {   9765     } else {
9766     9766  
9767     }   9767     }
9768     break;   9768     break;
9769     case 2:   9769     case 2:
9770     tmp___1 = extractContigSamples16bits(src, dst, cols, sample, spp, bps,   9770     tmp___1 = extractContigSamples16bits(src, dst, cols, sample, spp, bps,
9771                                          count, first_col, cols);   9771                                          count, first_col, cols);
9772     if (tmp___1) {   9772     if (tmp___1) {
9773       return (1);   9773       return (1);
9774     } else {   9774     } else {
9775     9775  
9776     }   9776     }
9777     break;   9777     break;
9778     case 3:   9778     case 3:
9779     tmp___2 = extractContigSamples24bits(src, dst, cols, sample, spp, bps,   9779     tmp___2 = extractContigSamples24bits(src, dst, cols, sample, spp, bps,
9780                                          count, first_col, cols);   9780                                          count, first_col, cols);
9781     if (tmp___2) {   9781     if (tmp___2) {
9782       return (1);   9782       return (1);
9783     } else {   9783     } else {
9784     9784  
9785     }   9785     }
9786     break;   9786     break;
9787     case 5:   9787     case 5:
9788     case 4:   9788     case 4:
9789     tmp___3 = extractContigSamples32bits(src, dst, cols, sample, spp, bps,   9789     tmp___3 = extractContigSamples32bits(src, dst, cols, sample, spp, bps,
9790                                          count, first_col, cols);   9790                                          count, first_col, cols);
9791     if (tmp___3) {   9791     if (tmp___3) {
9792       return (1);   9792       return (1);
9793     } else {   9793     } else {
9794     9794  
9795     }   9795     }
9796     break;   9796     break;
9797     default:   9797     default:
9798     TIFFError("extractContigSamplesToBuffer", "Unsupported bit depth: %d",   9798     TIFFError("extractContigSamplesToBuffer", "Unsupported bit depth: %d",
9799               (int )bps);   9799               (int )bps);
9800     return (1);   9800     return (1);
9801     }   9801     }
9802     if ((unsigned int )dump->outfile != (unsigned int )((void *)0)) {   9802     if ((unsigned int )dump->outfile != (unsigned int )((void *)0)) {
9803       if (dump->level == 4) {   9803       if (dump->level == 4) {
9804         dump_buffer(dump->outfile, dump->format, (uint32 )1, dst_rowsize, row,   9804         dump_buffer(dump->outfile, dump->format, (uint32 )1, dst_rowsize, row,
9805                     dst);   9805                     dst);
9806       } else {   9806       } else {
9807     9807  
9808       }   9808       }
9809     } else {   9809     } else {
9810     9810  
9811     }   9811     }
9812     out += outskew;   9812     out += outskew;
9813     in += inskew;   9813     in += inskew;
9814     row ++;   9814     row ++;
9815   }   9815   }
9816   return (0);   9816   return (0);
9817 }   9817 }
9818 }   9818 }
9819 static void cpSeparateBufToContigBuf(uint8 *out , uint8 *in , uint32 rows ,   9819 static void cpSeparateBufToContigBuf(uint8 *out , uint8 *in , uint32 rows ,
9820                                      uint32 cols , int outskew , int inskew ,   9820                                      uint32 cols , int outskew , int inskew ,
9821                                      tsample_t spp , int bytes_per_sample )   9821                                      tsample_t spp , int bytes_per_sample )
9822 {   9822 {
9823   uint32 j ;   9823   uint32 j ;
9824   int n ;   9824   int n ;
9825   uint8 *tmp ;   9825   uint8 *tmp ;
9826   uint8 *tmp___0 ;   9826   uint8 *tmp___0 ;
9827   int tmp___1 ;   9827   int tmp___1 ;
9828   uint32 tmp___2 ;   9828   uint32 tmp___2 ;
9829   uint32 tmp___3 ;   9829   uint32 tmp___3 ;
9830     9830  
9831   {   9831   {
9832   while (1) {   9832   while (1) {
9833     tmp___3 = rows;   9833     tmp___3 = rows;
9834     rows --;   9834     rows --;
9835     if (tmp___3 > 0U) {   9835     if (tmp___3 > 0U) {
9836     9836  
9837     } else {   9837     } else {
9838       break;   9838       break;
9839     }   9839     }
9840     j = cols;   9840     j = cols;
9841     while (1) {   9841     while (1) {
9842       tmp___2 = j;   9842       tmp___2 = j;
9843       j --;   9843       j --;
9844       if (tmp___2 > 0U) {   9844       if (tmp___2 > 0U) {
9845     9845  
9846       } else {   9846       } else {
9847         break;   9847         break;
9848       }   9848       }
9849       n = bytes_per_sample;   9849       n = bytes_per_sample;
9850       while (1) {   9850       while (1) {
9851         tmp___1 = n;   9851         tmp___1 = n;
9852         n --;   9852         n --;
9853         if (tmp___1) {   9853         if (tmp___1) {
9854     9854  
9855         } else {   9855         } else {
9856           break;   9856           break;
9857         }   9857         }
9858         tmp = out;   9858         tmp = out;
9859         out ++;   9859         out ++;
9860         tmp___0 = in;   9860         tmp___0 = in;
9861         in ++;   9861         in ++;
9862         *tmp = *tmp___0;   9862         *tmp = *tmp___0;
9863       }   9863       }
9864       out += ((int )spp - 1) * bytes_per_sample;   9864       out += ((int )spp - 1) * bytes_per_sample;
9865     }   9865     }
9866     out += outskew;   9866     out += outskew;
9867     in += inskew;   9867     in += inskew;
9868   }   9868   }
9869   return;   9869   return;
9870 }   9870 }
9871 }   9871 }
9872 static int readContigStripsIntoBuffer(TIFF *in , uint8 *buf ,   9872 static int readContigStripsIntoBuffer(TIFF *in , uint8 *buf ,
9873                                       uint32 imagelength , uint32 imagewidth ,   9873                                       uint32 imagelength , uint32 imagewidth ,
9874                                       tsample_t spp )   9874                                       tsample_t spp )
9875 {   9875 {
9876   tsize_t scanlinesize ;   9876   tsize_t scanlinesize ;
9877   tmsize_t tmp ;   9877   tmsize_t tmp ;
9878   uint8 *bufp ;   9878   uint8 *bufp ;
9879   uint32 row ;   9879   uint32 row ;
9880   char const   *tmp___0 ;   9880   char const   *tmp___0 ;
9881   int tmp___1 ;   9881   int tmp___1 ;
9882     9882  
9883   {   9883   {
9884   tmp = TIFFScanlineSize(in);   9884   tmp = TIFFScanlineSize(in);
9885   scanlinesize = tmp;   9885   scanlinesize = tmp;
9886   bufp = buf;   9886   bufp = buf;
9887   row = (uint32 )0;   9887   row = (uint32 )0;
9888   while (row < imagelength) {   9888   while (row < imagelength) {
9889     tmp___1 = TIFFReadScanline(in, (tdata_t )bufp, row, (uint16 )0);   9889     tmp___1 = TIFFReadScanline(in, (tdata_t )bufp, row, (uint16 )0);
9890     if (tmp___1 < 0) {   9890     if (tmp___1 < 0) {
9891       if (! ignore) {   9891       if (! ignore) {
9892         tmp___0 = TIFFFileName(in);   9892         tmp___0 = TIFFFileName(in);
9893         TIFFError(tmp___0, "Error, can\'t read scanline %lu",   9893         TIFFError(tmp___0, "Error, can\'t read scanline %lu",
9894                   (unsigned long )row);   9894                   (unsigned long )row);
9895         return (0);   9895         return (0);
9896       } else {   9896       } else {
9897     9897  
9898       }   9898       }
9899     } else {   9899     } else {
9900     9900  
9901     }   9901     }
9902     bufp += scanlinesize;   9902     bufp += scanlinesize;
9903     row ++;   9903     row ++;
9904   }   9904   }
9905   return (1);   9905   return (1);
9906 }   9906 }
9907 }   9907 }
9908 static int combineSeparateSamples8bits(uint8 **in , uint8 *out , uint32 row ,   9908 static int combineSeparateSamples8bits(uint8 **in , uint8 *out , uint32 row ,
9909                                        uint32 cols , uint16 spp , uint16 bps ,   9909                                        uint32 cols , uint16 spp , uint16 bps ,
9910                                        FILE *dumpfile , int format , int level )   9910                                        FILE *dumpfile , int format , int level )
9911 {   9911 {
9912   int ready_bits ;   9912   int ready_bits ;
9913   int bytes_per_sample ;   9913   int bytes_per_sample ;
9914   uint32 dst_rowsize ;   9914   uint32 dst_rowsize ;
9915   uint32 bit_offset ;   9915   uint32 bit_offset ;
9916   uint32 col ;   9916   uint32 col ;
9917   uint32 src_byte ;   9917   uint32 src_byte ;
9918   uint32 src_bit ;   9918   uint32 src_bit ;
9919   uint8 maskbits ;   9919   uint8 maskbits ;
9920   uint8 matchbits ;   9920   uint8 matchbits ;
9921   uint8 buff1 ;   9921   uint8 buff1 ;
9922   uint8 buff2 ;   9922   uint8 buff2 ;
9923   tsample_t s ;   9923   tsample_t s ;
9924   unsigned char *src ;   9924   unsigned char *src ;
9925   unsigned char *dst ;   9925   unsigned char *dst ;
9926   char action[32] ;   9926   char action[32] ;
9927   unsigned char *tmp ;   9927   unsigned char *tmp ;
9928   unsigned char *tmp___0 ;   9928   unsigned char *tmp___0 ;
9929     9929  
9930   {   9930   {
9931   ready_bits = 0;   9931   ready_bits = 0;
9932   bytes_per_sample = 0;   9932   bytes_per_sample = 0;
9933   src_byte = (uint32 )0;   9933   src_byte = (uint32 )0;
9934   src_bit = (uint32 )0;   9934   src_bit = (uint32 )0;
9935   maskbits = (uint8 )0;   9935   maskbits = (uint8 )0;
9936   matchbits = (uint8 )0;   9936   matchbits = (uint8 )0;
9937   buff1 = (uint8 )0;   9937   buff1 = (uint8 )0;
9938   buff2 = (uint8 )0;   9938   buff2 = (uint8 )0;
9939   src = *(in + 0);   9939   src = *(in + 0);
9940   dst = out;   9940   dst = out;
9941   if ((unsigned int )src == (unsigned int )((void *)0)) {   9941   if ((unsigned int )src == (unsigned int )((void *)0)) {
9942     TIFFError("combineSeparateSamples8bits", "Invalid input or output buffer");   9942     TIFFError("combineSeparateSamples8bits", "Invalid input or output buffer");
9943     return (1);   9943     return (1);
9944   } else   9944   } else
9945   if ((unsigned int )dst == (unsigned int )((void *)0)) {   9945   if ((unsigned int )dst == (unsigned int )((void *)0)) {
9946     TIFFError("combineSeparateSamples8bits", "Invalid input or output buffer");   9946     TIFFError("combineSeparateSamples8bits", "Invalid input or output buffer");
9947     return (1);   9947     return (1);
9948   } else {   9948   } else {
9949     9949  
9950   }   9950   }
9951   bytes_per_sample = ((int )bps + 7) / 8;   9951   bytes_per_sample = ((int )bps + 7) / 8;
9952   dst_rowsize = (((uint32 )bps * cols) * (uint32 )spp + 7U) / 8U;   9952   dst_rowsize = (((uint32 )bps * cols) * (uint32 )spp + 7U) / 8U;
9953   maskbits = (uint8 )(255 >> (8 - (int )bps));   9953   maskbits = (uint8 )(255 >> (8 - (int )bps));
9954   ready_bits = 0;   9954   ready_bits = 0;
9955   buff2 = (uint8 )0;   9955   buff2 = (uint8 )0;
9956   buff1 = buff2;   9956   buff1 = buff2;
9957   col = (uint32 )0;   9957   col = (uint32 )0;
9958   while (col < cols) {   9958   while (col < cols) {
9959     bit_offset = col * (uint32 )bps;   9959     bit_offset = col * (uint32 )bps;
9960     src_byte = bit_offset / 8U;   9960     src_byte = bit_offset / 8U;
9961     src_bit = bit_offset % 8U;   9961     src_bit = bit_offset % 8U;
9962     matchbits = (uint8 )((int )maskbits << ((8U - src_bit) - (uint32 )bps));   9962     matchbits = (uint8 )((int )maskbits << ((8U - src_bit) - (uint32 )bps));
9963     s = (tsample_t )0;   9963     s = (tsample_t )0;
9964     while ((int )s < (int )spp) {   9964     while ((int )s < (int )spp) {
9965       src = *(in + s) + src_byte;   9965       src = *(in + s) + src_byte;
9966       buff1 = (uint8 )(((int )*src & (int )matchbits) << src_bit);   9966       buff1 = (uint8 )(((int )*src & (int )matchbits) << src_bit);
9967       if (ready_bits >= 8) {   9967       if (ready_bits >= 8) {
9968         tmp = dst;   9968         tmp = dst;
9969         dst ++;   9969         dst ++;
9970         *tmp = buff2;   9970         *tmp = buff2;
9971         buff2 = buff1;   9971         buff2 = buff1;
9972         ready_bits -= 8;   9972         ready_bits -= 8;
9973         strcpy((char */* __restrict  */)(action),   9973         strcpy((char */* __restrict  */)(action),
9974                (char const   */* __restrict  */)"Flush");   9974                (char const   */* __restrict  */)"Flush");
9975       } else {   9975       } else {
9976         buff2 = (uint8 )((int )buff2 | ((int )buff1 >> ready_bits));   9976         buff2 = (uint8 )((int )buff2 | ((int )buff1 >> ready_bits));
9977         strcpy((char */* __restrict  */)(action),   9977         strcpy((char */* __restrict  */)(action),
9978                (char const   */* __restrict  */)"Update");   9978                (char const   */* __restrict  */)"Update");
9979       }   9979       }
9980       ready_bits += (int )bps;   9980       ready_bits += (int )bps;
9981       if ((unsigned int )dumpfile != (unsigned int )((void *)0)) {   9981       if ((unsigned int )dumpfile != (unsigned int )((void *)0)) {
9982         if (level == 3) {   9982         if (level == 3) {
9983           dump_info(dumpfile, format, (char *)"",   9983           dump_info(dumpfile, format, (char *)"",
9984                     (char *)"Row %3d, Col %3d, Samples %d, Src byte offset %3d  bit offset %2d  Dst offset %3d",   9984                     (char *)"Row %3d, Col %3d, Samples %d, Src byte offset %3d  bit offset %2d  Dst offset %3d",
9985                     row + 1U, col + 1U, (int )s, src_byte, src_bit, dst - out);   9985                     row + 1U, col + 1U, (int )s, src_byte, src_bit, dst - out);
9986           dump_byte(dumpfile, format, (char *)"Match bits", matchbits);   9986           dump_byte(dumpfile, format, (char *)"Match bits", matchbits);
9987           dump_byte(dumpfile, format, (char *)"Src   bits", *src);   9987           dump_byte(dumpfile, format, (char *)"Src   bits", *src);
9988           dump_byte(dumpfile, format, (char *)"Buff1 bits", buff1);   9988           dump_byte(dumpfile, format, (char *)"Buff1 bits", buff1);
9989           dump_byte(dumpfile, format, (char *)"Buff2 bits", buff2);   9989           dump_byte(dumpfile, format, (char *)"Buff2 bits", buff2);
9990           dump_info(dumpfile, format, (char *)"", (char *)"%s", action);   9990           dump_info(dumpfile, format, (char *)"", (char *)"%s", action);
9991         } else {   9991         } else {
9992     9992  
9993         }   9993         }
9994       } else {   9994       } else {
9995     9995  
9996       }   9996       }
9997       s = (tsample_t )((int )s + 1);   9997       s = (tsample_t )((int )s + 1);
9998     }   9998     }
9999     col ++;   9999     col ++;
10000   }   10000   }
10001   if (ready_bits > 0) {   10001   if (ready_bits > 0) {
10002     buff1 = (uint8 )((unsigned int )buff2 & (255U << (8 - ready_bits)));   10002     buff1 = (uint8 )((unsigned int )buff2 & (255U << (8 - ready_bits)));
10003     tmp___0 = dst;   10003     tmp___0 = dst;
10004     dst ++;   10004     dst ++;
10005     *tmp___0 = buff1;   10005     *tmp___0 = buff1;
10006     if ((unsigned int )dumpfile != (unsigned int )((void *)0)) {   10006     if ((unsigned int )dumpfile != (unsigned int )((void *)0)) {
10007       if (level == 3) {   10007       if (level == 3) {
10008         dump_info(dumpfile, format, (char *)"",   10008         dump_info(dumpfile, format, (char *)"",
10009                   (char *)"Row %3d, Col %3d, Src byte offset %3d  bit offset %2d  Dst offset %3d",   10009                   (char *)"Row %3d, Col %3d, Src byte offset %3d  bit offset %2d  Dst offset %3d",
10010                   row + 1U, col + 1U, src_byte, src_bit, dst - out);   10010                   row + 1U, col + 1U, src_byte, src_bit, dst - out);
10011         dump_byte(dumpfile, format, (char *)"Final bits", buff1);   10011         dump_byte(dumpfile, format, (char *)"Final bits", buff1);
10012       } else {   10012       } else {
10013     10013  
10014       }   10014       }
10015     } else {   10015     } else {
10016     10016  
10017     }   10017     }
10018   } else {   10018   } else {
10019     10019  
10020   }   10020   }
10021   if ((unsigned int )dumpfile != (unsigned int )((void *)0)) {   10021   if ((unsigned int )dumpfile != (unsigned int )((void *)0)) {
10022     if (level == 2) {   10022     if (level == 2) {
10023       dump_info(dumpfile, format, (char *)"combineSeparateSamples8bits",   10023       dump_info(dumpfile, format, (char *)"combineSeparateSamples8bits",
10024                 (char *)"Output data");   10024                 (char *)"Output data");
10025       dump_buffer(dumpfile, format, (uint32 )1, dst_rowsize, row, out);   10025       dump_buffer(dumpfile, format, (uint32 )1, dst_rowsize, row, out);
10026     } else {   10026     } else {
10027     10027  
10028     }   10028     }
10029   } else {   10029   } else {
10030     10030  
10031   }   10031   }
10032   return (0);   10032   return (0);
10033 }   10033 }
10034 }   10034 }
10035 static int combineSeparateSamples16bits(uint8 **in , uint8 *out , uint32 row ,   10035 static int combineSeparateSamples16bits(uint8 **in , uint8 *out , uint32 row ,
10036                                         uint32 cols , uint16 spp , uint16 bps ,   10036                                         uint32 cols , uint16 spp , uint16 bps ,
10037                                         FILE *dumpfile , int format , int level )   10037                                         FILE *dumpfile , int format , int level )
10038 {   10038 {
10039   int ready_bits ;   10039   int ready_bits ;
10040   int bytes_per_sample ;   10040   int bytes_per_sample ;
10041   uint32 dst_rowsize ;   10041   uint32 dst_rowsize ;
10042   uint32 bit_offset ;   10042   uint32 bit_offset ;
10043   uint32 col ;   10043   uint32 col ;
10044   uint32 src_byte ;   10044   uint32 src_byte ;
10045   uint32 src_bit ;   10045   uint32 src_bit ;
10046   uint16 maskbits ;   10046   uint16 maskbits ;
10047   uint16 matchbits ;   10047   uint16 matchbits ;
10048   uint16 buff1 ;   10048   uint16 buff1 ;
10049   uint16 buff2 ;   10049   uint16 buff2 ;
10050   uint8 bytebuff ;   10050   uint8 bytebuff ;
10051   tsample_t s ;   10051   tsample_t s ;
10052   unsigned char *src ;   10052   unsigned char *src ;
10053   unsigned char *dst ;   10053   unsigned char *dst ;
10054   unsigned char swapbuff[2] ;   10054   unsigned char swapbuff[2] ;
10055   char action[8] ;   10055   char action[8] ;
10056   unsigned char *tmp ;   10056   unsigned char *tmp ;
10057   unsigned char *tmp___0 ;   10057   unsigned char *tmp___0 ;
10058     10058  
10059   {   10059   {
10060   ready_bits = 0;   10060   ready_bits = 0;
10061   bytes_per_sample = 0;   10061   bytes_per_sample = 0;
10062   src_byte = (uint32 )0;   10062   src_byte = (uint32 )0;
10063   src_bit = (uint32 )0;   10063   src_bit = (uint32 )0;
10064   maskbits = (uint16 )0;   10064   maskbits = (uint16 )0;
10065   matchbits = (uint16 )0;   10065   matchbits = (uint16 )0;
10066   buff1 = (uint16 )0;   10066   buff1 = (uint16 )0;
10067   buff2 = (uint16 )0;   10067   buff2 = (uint16 )0;
10068   bytebuff = (uint8 )0;   10068   bytebuff = (uint8 )0;
10069   src = *(in + 0);   10069   src = *(in + 0);
10070   dst = out;   10070   dst = out;
10071   if ((unsigned int )src == (unsigned int )((void *)0)) {   10071   if ((unsigned int )src == (unsigned int )((void *)0)) {
10072     TIFFError("combineSeparateSamples16bits", "Invalid input or output buffer");   10072     TIFFError("combineSeparateSamples16bits", "Invalid input or output buffer");
10073     return (1);   10073     return (1);
10074   } else   10074   } else
10075   if ((unsigned int )dst == (unsigned int )((void *)0)) {   10075   if ((unsigned int )dst == (unsigned int )((void *)0)) {
10076     TIFFError("combineSeparateSamples16bits", "Invalid input or output buffer");   10076     TIFFError("combineSeparateSamples16bits", "Invalid input or output buffer");
10077     return (1);   10077     return (1);
10078   } else {   10078   } else {
10079     10079  
10080   }   10080   }
10081   bytes_per_sample = ((int )bps + 7) / 8;   10081   bytes_per_sample = ((int )bps + 7) / 8;
10082   dst_rowsize = (((uint32 )bps * cols) * (uint32 )spp + 7U) / 8U;   10082   dst_rowsize = (((uint32 )bps * cols) * (uint32 )spp + 7U) / 8U;
10083   maskbits = (uint16 )(65535 >> (16 - (int )bps));   10083   maskbits = (uint16 )(65535 >> (16 - (int )bps));
10084   ready_bits = 0;   10084   ready_bits = 0;
10085   buff2 = (uint16 )0;   10085   buff2 = (uint16 )0;
10086   buff1 = buff2;   10086   buff1 = buff2;
10087   col = (uint32 )0;   10087   col = (uint32 )0;
10088   while (col < cols) {   10088   while (col < cols) {
10089     bit_offset = col * (uint32 )bps;   10089     bit_offset = col * (uint32 )bps;
10090     src_byte = bit_offset / 8U;   10090     src_byte = bit_offset / 8U;
10091     src_bit = bit_offset % 8U;   10091     src_bit = bit_offset % 8U;
10092     matchbits = (uint16 )((int )maskbits << ((16U - src_bit) - (uint32 )bps));   10092     matchbits = (uint16 )((int )maskbits << ((16U - src_bit) - (uint32 )bps));
10093     s = (tsample_t )0;   10093     s = (tsample_t )0;
10094     while ((int )s < (int )spp) {   10094     while ((int )s < (int )spp) {
10095       src = *(in + s) + src_byte;   10095       src = *(in + s) + src_byte;
10096       if (little_endian) {   10096       if (little_endian) {
10097         swapbuff[1] = *src;   10097         swapbuff[1] = *src;
10098         swapbuff[0] = *(src + 1);   10098         swapbuff[0] = *(src + 1);
10099       } else {   10099       } else {
10100         swapbuff[0] = *src;   10100         swapbuff[0] = *src;
10101         swapbuff[1] = *(src + 1);   10101         swapbuff[1] = *(src + 1);
10102       }   10102       }
10103       buff1 = *((uint16 *)(swapbuff));   10103       buff1 = *((uint16 *)(swapbuff));
10104       buff1 = (uint16 )(((int )buff1 & (int )matchbits) << src_bit);   10104       buff1 = (uint16 )(((int )buff1 & (int )matchbits) << src_bit);
10105       if (ready_bits >= 8) {   10105       if (ready_bits >= 8) {
10106         bytebuff = (uint8 )((int )buff2 >> 8);   10106         bytebuff = (uint8 )((int )buff2 >> 8);
10107         tmp = dst;   10107         tmp = dst;
10108         dst ++;   10108         dst ++;
10109         *tmp = bytebuff;   10109         *tmp = bytebuff;
10110         ready_bits -= 8;   10110         ready_bits -= 8;
10111         buff2 = (uint16 )(((int )buff2 << 8) | ((int )buff1 >> ready_bits));   10111         buff2 = (uint16 )(((int )buff2 << 8) | ((int )buff1 >> ready_bits));
10112         strcpy((char */* __restrict  */)(action),   10112         strcpy((char */* __restrict  */)(action),
10113                (char const   */* __restrict  */)"Flush");   10113                (char const   */* __restrict  */)"Flush");
10114       } else {   10114       } else {
10115         bytebuff = (uint8 )0;   10115         bytebuff = (uint8 )0;
10116         buff2 = (uint16 )((int )buff2 | ((int )buff1 >> ready_bits));   10116         buff2 = (uint16 )((int )buff2 | ((int )buff1 >> ready_bits));
10117         strcpy((char */* __restrict  */)(action),   10117         strcpy((char */* __restrict  */)(action),
10118                (char const   */* __restrict  */)"Update");   10118                (char const   */* __restrict  */)"Update");
10119       }   10119       }
10120       ready_bits += (int )bps;   10120       ready_bits += (int )bps;
10121       if ((unsigned int )dumpfile != (unsigned int )((void *)0)) {   10121       if ((unsigned int )dumpfile != (unsigned int )((void *)0)) {
10122         if (level == 3) {   10122         if (level == 3) {
10123           dump_info(dumpfile, format, (char *)"",   10123           dump_info(dumpfile, format, (char *)"",
10124                     (char *)"Row %3d, Col %3d, Samples %d, Src byte offset %3d  bit offset %2d  Dst offset %3d",   10124                     (char *)"Row %3d, Col %3d, Samples %d, Src byte offset %3d  bit offset %2d  Dst offset %3d",
10125                     row + 1U, col + 1U, (int )s, src_byte, src_bit, dst - out);   10125                     row + 1U, col + 1U, (int )s, src_byte, src_bit, dst - out);
10126           dump_short(dumpfile, format, (char *)"Match bits", matchbits);   10126           dump_short(dumpfile, format, (char *)"Match bits", matchbits);
10127           dump_data(dumpfile, format, (char *)"Src   bits", src, (uint32 )2);   10127           dump_data(dumpfile, format, (char *)"Src   bits", src, (uint32 )2);
10128           dump_short(dumpfile, format, (char *)"Buff1 bits", buff1);   10128           dump_short(dumpfile, format, (char *)"Buff1 bits", buff1);
10129           dump_short(dumpfile, format, (char *)"Buff2 bits", buff2);   10129           dump_short(dumpfile, format, (char *)"Buff2 bits", buff2);
10130           dump_byte(dumpfile, format, (char *)"Write byte", bytebuff);   10130           dump_byte(dumpfile, format, (char *)"Write byte", bytebuff);
10131           dump_info(dumpfile, format, (char *)"", (char *)"Ready bits:  %d, %s",   10131           dump_info(dumpfile, format, (char *)"", (char *)"Ready bits:  %d, %s",
10132                     ready_bits, action);   10132                     ready_bits, action);
10133         } else {   10133         } else {
10134     10134  
10135         }   10135         }
10136       } else {   10136       } else {
10137     10137  
10138       }   10138       }
10139       s = (tsample_t )((int )s + 1);   10139       s = (tsample_t )((int )s + 1);
10140     }   10140     }
10141     col ++;   10141     col ++;
10142   }   10142   }
10143   if (ready_bits > 0) {   10143   if (ready_bits > 0) {
10144     bytebuff = (uint8 )((int )buff2 >> 8);   10144     bytebuff = (uint8 )((int )buff2 >> 8);
10145     tmp___0 = dst;   10145     tmp___0 = dst;
10146     dst ++;   10146     dst ++;
10147     *tmp___0 = bytebuff;   10147     *tmp___0 = bytebuff;
10148     if ((unsigned int )dumpfile != (unsigned int )((void *)0)) {   10148     if ((unsigned int )dumpfile != (unsigned int )((void *)0)) {
10149       if (level == 3) {   10149       if (level == 3) {
10150         dump_info(dumpfile, format, (char *)"",   10150         dump_info(dumpfile, format, (char *)"",
10151                   (char *)"Row %3d, Col %3d, Src byte offset %3d  bit offset %2d  Dst offset %3d",   10151                   (char *)"Row %3d, Col %3d, Src byte offset %3d  bit offset %2d  Dst offset %3d",
10152                   row + 1U, col + 1U, src_byte, src_bit, dst - out);   10152                   row + 1U, col + 1U, src_byte, src_bit, dst - out);
10153         dump_byte(dumpfile, format, (char *)"Final bits", bytebuff);   10153         dump_byte(dumpfile, format, (char *)"Final bits", bytebuff);
10154       } else {   10154       } else {
10155     10155  
10156       }   10156       }
10157     } else {   10157     } else {
10158     10158  
10159     }   10159     }
10160   } else {   10160   } else {
10161     10161  
10162   }   10162   }
10163   if ((unsigned int )dumpfile != (unsigned int )((void *)0)) {   10163   if ((unsigned int )dumpfile != (unsigned int )((void *)0)) {
10164     if (level == 2) {   10164     if (level == 2) {
10165       dump_info(dumpfile, format, (char *)"combineSeparateSamples16bits",   10165       dump_info(dumpfile, format, (char *)"combineSeparateSamples16bits",
10166                 (char *)"Output data");   10166                 (char *)"Output data");
10167       dump_buffer(dumpfile, format, (uint32 )1, dst_rowsize, row, out);   10167       dump_buffer(dumpfile, format, (uint32 )1, dst_rowsize, row, out);
10168     } else {   10168     } else {
10169     10169  
10170     }   10170     }
10171   } else {   10171   } else {
10172     10172  
10173   }   10173   }
10174   return (0);   10174   return (0);
10175 }   10175 }
10176 }   10176 }
10177 static int combineSeparateSamples24bits(uint8 **in , uint8 *out , uint32 row ,   10177 static int combineSeparateSamples24bits(uint8 **in , uint8 *out , uint32 row ,
10178                                         uint32 cols , uint16 spp , uint16 bps ,   10178                                         uint32 cols , uint16 spp , uint16 bps ,
10179                                         FILE *dumpfile , int format , int level )   10179                                         FILE *dumpfile , int format , int level )
10180 {   10180 {
10181   int ready_bits ;   10181   int ready_bits ;
10182   int bytes_per_sample ;   10182   int bytes_per_sample ;
10183   uint32 dst_rowsize ;   10183   uint32 dst_rowsize ;
10184   uint32 bit_offset ;   10184   uint32 bit_offset ;
10185   uint32 col ;   10185   uint32 col ;
10186   uint32 src_byte ;   10186   uint32 src_byte ;
10187   uint32 src_bit ;   10187   uint32 src_bit ;
10188   uint32 maskbits ;   10188   uint32 maskbits ;
10189   uint32 matchbits ;   10189   uint32 matchbits ;
10190   uint32 buff1 ;   10190   uint32 buff1 ;
10191   uint32 buff2 ;   10191   uint32 buff2 ;
10192   uint8 bytebuff1 ;   10192   uint8 bytebuff1 ;
10193   uint8 bytebuff2 ;   10193   uint8 bytebuff2 ;
10194   tsample_t s ;   10194   tsample_t s ;
10195   unsigned char *src ;   10195   unsigned char *src ;
10196   unsigned char *dst ;   10196   unsigned char *dst ;
10197   unsigned char swapbuff[4] ;   10197   unsigned char swapbuff[4] ;
10198   char action[8] ;   10198   char action[8] ;
10199   unsigned char *tmp ;   10199   unsigned char *tmp ;
10200   unsigned char *tmp___0 ;   10200   unsigned char *tmp___0 ;
10201   unsigned char *tmp___1 ;   10201   unsigned char *tmp___1 ;
10202     10202  
10203   {   10203   {
10204   ready_bits = 0;   10204   ready_bits = 0;
10205   bytes_per_sample = 0;   10205   bytes_per_sample = 0;
10206   src_byte = (uint32 )0;   10206   src_byte = (uint32 )0;
10207   src_bit = (uint32 )0;   10207   src_bit = (uint32 )0;
10208   maskbits = (uint32 )0;   10208   maskbits = (uint32 )0;
10209   matchbits = (uint32 )0;   10209   matchbits = (uint32 )0;
10210   buff1 = (uint32 )0;   10210   buff1 = (uint32 )0;
10211   buff2 = (uint32 )0;   10211   buff2 = (uint32 )0;
10212   bytebuff1 = (uint8 )0;   10212   bytebuff1 = (uint8 )0;
10213   bytebuff2 = (uint8 )0;   10213   bytebuff2 = (uint8 )0;
10214   src = *(in + 0);   10214   src = *(in + 0);
10215   dst = out;   10215   dst = out;
10216   if ((unsigned int )src == (unsigned int )((void *)0)) {   10216   if ((unsigned int )src == (unsigned int )((void *)0)) {
10217     TIFFError("combineSeparateSamples24bits", "Invalid input or output buffer");   10217     TIFFError("combineSeparateSamples24bits", "Invalid input or output buffer");
10218     return (1);   10218     return (1);
10219   } else   10219   } else
10220   if ((unsigned int )dst == (unsigned int )((void *)0)) {   10220   if ((unsigned int )dst == (unsigned int )((void *)0)) {
10221     TIFFError("combineSeparateSamples24bits", "Invalid input or output buffer");   10221     TIFFError("combineSeparateSamples24bits", "Invalid input or output buffer");
10222     return (1);   10222     return (1);
10223   } else {   10223   } else {
10224     10224  
10225   }   10225   }
10226   bytes_per_sample = ((int )bps + 7) / 8;   10226   bytes_per_sample = ((int )bps + 7) / 8;
10227   dst_rowsize = ((uint32 )bps * cols + 7U) / 8U;   10227   dst_rowsize = ((uint32 )bps * cols + 7U) / 8U;
10228   maskbits = 4294967295U >> (32 - (int )bps);   10228   maskbits = 4294967295U >> (32 - (int )bps);
10229   ready_bits = 0;   10229   ready_bits = 0;
10230   buff2 = (uint32 )0;   10230   buff2 = (uint32 )0;
10231   buff1 = buff2;   10231   buff1 = buff2;
10232   col = (uint32 )0;   10232   col = (uint32 )0;
10233   while (col < cols) {   10233   while (col < cols) {
10234     bit_offset = col * (uint32 )bps;   10234     bit_offset = col * (uint32 )bps;
10235     src_byte = bit_offset / 8U;   10235     src_byte = bit_offset / 8U;
10236     src_bit = bit_offset % 8U;   10236     src_bit = bit_offset % 8U;
10237     matchbits = maskbits << ((32U - src_bit) - (uint32 )bps);   10237     matchbits = maskbits << ((32U - src_bit) - (uint32 )bps);
10238     s = (tsample_t )0;   10238     s = (tsample_t )0;
10239     while ((int )s < (int )spp) {   10239     while ((int )s < (int )spp) {
10240       src = *(in + s) + src_byte;   10240       src = *(in + s) + src_byte;
10241       if (little_endian) {   10241       if (little_endian) {
10242         swapbuff[3] = *src;   10242         swapbuff[3] = *src;
10243         swapbuff[2] = *(src + 1);   10243         swapbuff[2] = *(src + 1);
10244         swapbuff[1] = *(src + 2);   10244         swapbuff[1] = *(src + 2);
10245         swapbuff[0] = *(src + 3);   10245         swapbuff[0] = *(src + 3);
10246       } else {   10246       } else {
10247         swapbuff[0] = *src;   10247         swapbuff[0] = *src;
10248         swapbuff[1] = *(src + 1);   10248         swapbuff[1] = *(src + 1);
10249         swapbuff[2] = *(src + 2);   10249         swapbuff[2] = *(src + 2);
10250         swapbuff[3] = *(src + 3);   10250         swapbuff[3] = *(src + 3);
10251       }   10251       }
10252       buff1 = *((uint32 *)(swapbuff));   10252       buff1 = *((uint32 *)(swapbuff));
10253       buff1 = (buff1 & matchbits) << src_bit;   10253       buff1 = (buff1 & matchbits) << src_bit;
10254       if (ready_bits >= 16) {   10254       if (ready_bits >= 16) {
10255         bytebuff1 = (uint8 )(buff2 >> 24);   10255         bytebuff1 = (uint8 )(buff2 >> 24);
10256         tmp = dst;   10256         tmp = dst;
10257         dst ++;   10257         dst ++;
10258         *tmp = bytebuff1;   10258         *tmp = bytebuff1;
10259         bytebuff2 = (uint8 )(buff2 >> 16);   10259         bytebuff2 = (uint8 )(buff2 >> 16);
10260         tmp___0 = dst;   10260         tmp___0 = dst;
10261         dst ++;   10261         dst ++;
10262         *tmp___0 = bytebuff2;   10262         *tmp___0 = bytebuff2;
10263         ready_bits -= 16;   10263         ready_bits -= 16;
10264         buff2 = (buff2 << 16) | (buff1 >> ready_bits);   10264         buff2 = (buff2 << 16) | (buff1 >> ready_bits);
10265         strcpy((char */* __restrict  */)(action),   10265         strcpy((char */* __restrict  */)(action),
10266                (char const   */* __restrict  */)"Flush");   10266                (char const   */* __restrict  */)"Flush");
10267       } else {   10267       } else {
10268         bytebuff2 = (uint8 )0;   10268         bytebuff2 = (uint8 )0;
10269         bytebuff1 = bytebuff2;   10269         bytebuff1 = bytebuff2;
10270         buff2 |= buff1 >> ready_bits;   10270         buff2 |= buff1 >> ready_bits;
10271         strcpy((char */* __restrict  */)(action),   10271         strcpy((char */* __restrict  */)(action),
10272                (char const   */* __restrict  */)"Update");   10272                (char const   */* __restrict  */)"Update");
10273       }   10273       }
10274       ready_bits += (int )bps;   10274       ready_bits += (int )bps;
10275       if ((unsigned int )dumpfile != (unsigned int )((void *)0)) {   10275       if ((unsigned int )dumpfile != (unsigned int )((void *)0)) {
10276         if (level == 3) {   10276         if (level == 3) {
10277           dump_info(dumpfile, format, (char *)"",   10277           dump_info(dumpfile, format, (char *)"",
10278                     (char *)"Row %3d, Col %3d, Samples %d, Src byte offset %3d  bit offset %2d  Dst offset %3d",   10278                     (char *)"Row %3d, Col %3d, Samples %d, Src byte offset %3d  bit offset %2d  Dst offset %3d",
10279                     row + 1U, col + 1U, (int )s, src_byte, src_bit, dst - out);   10279                     row + 1U, col + 1U, (int )s, src_byte, src_bit, dst - out);
10280           dump_long(dumpfile, format, (char *)"Match bits ", matchbits);   10280           dump_long(dumpfile, format, (char *)"Match bits ", matchbits);
10281           dump_data(dumpfile, format, (char *)"Src   bits ", src, (uint32 )4);   10281           dump_data(dumpfile, format, (char *)"Src   bits ", src, (uint32 )4);
10282           dump_long(dumpfile, format, (char *)"Buff1 bits ", buff1);   10282           dump_long(dumpfile, format, (char *)"Buff1 bits ", buff1);
10283           dump_long(dumpfile, format, (char *)"Buff2 bits ", buff2);   10283           dump_long(dumpfile, format, (char *)"Buff2 bits ", buff2);
10284           dump_byte(dumpfile, format, (char *)"Write bits1", bytebuff1);   10284           dump_byte(dumpfile, format, (char *)"Write bits1", bytebuff1);
10285           dump_byte(dumpfile, format, (char *)"Write bits2", bytebuff2);   10285           dump_byte(dumpfile, format, (char *)"Write bits2", bytebuff2);
10286           dump_info(dumpfile, format, (char *)"",   10286           dump_info(dumpfile, format, (char *)"",
10287                     (char *)"Ready bits:   %d, %s", ready_bits, action);   10287                     (char *)"Ready bits:   %d, %s", ready_bits, action);
10288         } else {   10288         } else {
10289     10289  
10290         }   10290         }
10291       } else {   10291       } else {
10292     10292  
10293       }   10293       }
10294       s = (tsample_t )((int )s + 1);   10294       s = (tsample_t )((int )s + 1);
10295     }   10295     }
10296     col ++;   10296     col ++;
10297   }   10297   }
10298   while (ready_bits > 0) {   10298   while (ready_bits > 0) {
10299     bytebuff1 = (uint8 )(buff2 >> 24);   10299     bytebuff1 = (uint8 )(buff2 >> 24);
10300     tmp___1 = dst;   10300     tmp___1 = dst;
10301     dst ++;   10301     dst ++;
10302     *tmp___1 = bytebuff1;   10302     *tmp___1 = bytebuff1;
10303     buff2 <<= 8;   10303     buff2 <<= 8;
10304     bytebuff2 = bytebuff1;   10304     bytebuff2 = bytebuff1;
10305     ready_bits -= 8;   10305     ready_bits -= 8;
10306   }   10306   }
10307   if ((unsigned int )dumpfile != (unsigned int )((void *)0)) {   10307   if ((unsigned int )dumpfile != (unsigned int )((void *)0)) {
10308     if (level == 3) {   10308     if (level == 3) {
10309       dump_info(dumpfile, format, (char *)"",   10309       dump_info(dumpfile, format, (char *)"",
10310                 (char *)"Row %3d, Col %3d, Src byte offset %3d  bit offset %2d  Dst offset %3d",   10310                 (char *)"Row %3d, Col %3d, Src byte offset %3d  bit offset %2d  Dst offset %3d",
10311                 row + 1U, col + 1U, src_byte, src_bit, dst - out);   10311                 row + 1U, col + 1U, src_byte, src_bit, dst - out);
10312       dump_long(dumpfile, format, (char *)"Match bits ", matchbits);   10312       dump_long(dumpfile, format, (char *)"Match bits ", matchbits);
10313       dump_data(dumpfile, format, (char *)"Src   bits ", src, (uint32 )4);   10313       dump_data(dumpfile, format, (char *)"Src   bits ", src, (uint32 )4);
10314       dump_long(dumpfile, format, (char *)"Buff1 bits ", buff1);   10314       dump_long(dumpfile, format, (char *)"Buff1 bits ", buff1);
10315       dump_long(dumpfile, format, (char *)"Buff2 bits ", buff2);   10315       dump_long(dumpfile, format, (char *)"Buff2 bits ", buff2);
10316       dump_byte(dumpfile, format, (char *)"Write bits1", bytebuff1);   10316       dump_byte(dumpfile, format, (char *)"Write bits1", bytebuff1);
10317       dump_byte(dumpfile, format, (char *)"Write bits2", bytebuff2);   10317       dump_byte(dumpfile, format, (char *)"Write bits2", bytebuff2);
10318       dump_info(dumpfile, format, (char *)"", (char *)"Ready bits:  %2d",   10318       dump_info(dumpfile, format, (char *)"", (char *)"Ready bits:  %2d",
10319                 ready_bits);   10319                 ready_bits);
10320     } else {   10320     } else {
10321     10321  
10322     }   10322     }
10323   } else {   10323   } else {
10324     10324  
10325   }   10325   }
10326   if ((unsigned int )dumpfile != (unsigned int )((void *)0)) {   10326   if ((unsigned int )dumpfile != (unsigned int )((void *)0)) {
10327     if (level == 2) {   10327     if (level == 2) {
10328       dump_info(dumpfile, format, (char *)"combineSeparateSamples24bits",   10328       dump_info(dumpfile, format, (char *)"combineSeparateSamples24bits",
10329                 (char *)"Output data");   10329                 (char *)"Output data");
10330       dump_buffer(dumpfile, format, (uint32 )1, dst_rowsize, row, out);   10330       dump_buffer(dumpfile, format, (uint32 )1, dst_rowsize, row, out);
10331     } else {   10331     } else {
10332     10332  
10333     }   10333     }
10334   } else {   10334   } else {
10335     10335  
10336   }   10336   }
10337   return (0);   10337   return (0);
10338 }   10338 }
10339 }   10339 }
10340 static int combineSeparateSamples32bits(uint8 **in , uint8 *out , uint32 row ,   10340 static int combineSeparateSamples32bits(uint8 **in , uint8 *out , uint32 row ,
10341                                         uint32 cols , uint16 spp , uint16 bps ,   10341                                         uint32 cols , uint16 spp , uint16 bps ,
10342                                         FILE *dumpfile , int format , int level )   10342                                         FILE *dumpfile , int format , int level )
10343 {   10343 {
10344   int ready_bits ;   10344   int ready_bits ;
10345   int bytes_per_sample ;   10345   int bytes_per_sample ;
10346   int shift_width ;   10346   int shift_width ;
10347   uint32 dst_rowsize ;   10347   uint32 dst_rowsize ;
10348   uint32 bit_offset ;   10348   uint32 bit_offset ;
10349   uint32 src_byte ;   10349   uint32 src_byte ;
10350   uint32 src_bit ;   10350   uint32 src_bit ;
10351   uint32 col ;   10351   uint32 col ;
10352   uint32 longbuff1 ;   10352   uint32 longbuff1 ;
10353   uint32 longbuff2 ;   10353   uint32 longbuff2 ;
10354   uint64 maskbits ;   10354   uint64 maskbits ;
10355   uint64 matchbits ;   10355   uint64 matchbits ;
10356   uint64 buff1 ;   10356   uint64 buff1 ;
10357   uint64 buff2 ;   10357   uint64 buff2 ;
10358   uint64 buff3 ;   10358   uint64 buff3 ;
10359   uint8 bytebuff1 ;   10359   uint8 bytebuff1 ;
10360   uint8 bytebuff2 ;   10360   uint8 bytebuff2 ;
10361   uint8 bytebuff3 ;   10361   uint8 bytebuff3 ;
10362   uint8 bytebuff4 ;   10362   uint8 bytebuff4 ;
10363   tsample_t s ;   10363   tsample_t s ;
10364   unsigned char *src ;   10364   unsigned char *src ;
10365   unsigned char *dst ;   10365   unsigned char *dst ;
10366   unsigned char swapbuff1[4] ;   10366   unsigned char swapbuff1[4] ;
10367   unsigned char swapbuff2[4] ;   10367   unsigned char swapbuff2[4] ;
10368   char action[8] ;   10368   char action[8] ;
10369   unsigned char *tmp ;   10369   unsigned char *tmp ;
10370   unsigned char *tmp___0 ;   10370   unsigned char *tmp___0 ;
10371   unsigned char *tmp___1 ;   10371   unsigned char *tmp___1 ;
10372   unsigned char *tmp___2 ;   10372   unsigned char *tmp___2 ;
10373   unsigned char *tmp___3 ;   10373   unsigned char *tmp___3 ;
10374     10374  
10375   {   10375   {
10376   ready_bits = 0;   10376   ready_bits = 0;
10377   bytes_per_sample = 0;   10377   bytes_per_sample = 0;
10378   shift_width = 0;   10378   shift_width = 0;
10379   src_byte = (uint32 )0;   10379   src_byte = (uint32 )0;
10380   src_bit = (uint32 )0;   10380   src_bit = (uint32 )0;
10381   longbuff1 = (uint32 )0;   10381   longbuff1 = (uint32 )0;
10382   longbuff2 = (uint32 )0;   10382   longbuff2 = (uint32 )0;
10383   maskbits = (uint64 )0;   10383   maskbits = (uint64 )0;
10384   matchbits = (uint64 )0;   10384   matchbits = (uint64 )0;
10385   buff1 = (uint64 )0;   10385   buff1 = (uint64 )0;
10386   buff2 = (uint64 )0;   10386   buff2 = (uint64 )0;
10387   buff3 = (uint64 )0;   10387   buff3 = (uint64 )0;
10388   bytebuff1 = (uint8 )0;   10388   bytebuff1 = (uint8 )0;
10389   bytebuff2 = (uint8 )0;   10389   bytebuff2 = (uint8 )0;
10390   bytebuff3 = (uint8 )0;   10390   bytebuff3 = (uint8 )0;
10391   bytebuff4 = (uint8 )0;   10391   bytebuff4 = (uint8 )0;
10392   src = *(in + 0);   10392   src = *(in + 0);
10393   dst = out;   10393   dst = out;
10394   if ((unsigned int )src == (unsigned int )((void *)0)) {   10394   if ((unsigned int )src == (unsigned int )((void *)0)) {
10395     TIFFError("combineSeparateSamples32bits", "Invalid input or output buffer");   10395     TIFFError("combineSeparateSamples32bits", "Invalid input or output buffer");
10396     return (1);   10396     return (1);
10397   } else   10397   } else
10398   if ((unsigned int )dst == (unsigned int )((void *)0)) {   10398   if ((unsigned int )dst == (unsigned int )((void *)0)) {
10399     TIFFError("combineSeparateSamples32bits", "Invalid input or output buffer");   10399     TIFFError("combineSeparateSamples32bits", "Invalid input or output buffer");
10400     return (1);   10400     return (1);
10401   } else {   10401   } else {
10402     10402  
10403   }   10403   }
10404   bytes_per_sample = ((int )bps + 7) / 8;   10404   bytes_per_sample = ((int )bps + 7) / 8;
10405   dst_rowsize = ((uint32 )bps * cols + 7U) / 8U;   10405   dst_rowsize = ((uint32 )bps * cols + 7U) / 8U;
10406   maskbits = 0xffffffffffffffffULL >> (64 - (int )bps);   10406   maskbits = 0xffffffffffffffffULL >> (64 - (int )bps);
10407   shift_width = ((int )bps + 7) / 8 + 1;   10407   shift_width = ((int )bps + 7) / 8 + 1;
10408   ready_bits = 0;   10408   ready_bits = 0;
10409   buff2 = (uint64 )0;   10409   buff2 = (uint64 )0;
10410   buff1 = buff2;   10410   buff1 = buff2;
10411   col = (uint32 )0;   10411   col = (uint32 )0;
10412   while (col < cols) {   10412   while (col < cols) {
10413     bit_offset = col * (uint32 )bps;   10413     bit_offset = col * (uint32 )bps;
10414     src_byte = bit_offset / 8U;   10414     src_byte = bit_offset / 8U;
10415     src_bit = bit_offset % 8U;   10415     src_bit = bit_offset % 8U;
10416     matchbits = maskbits << ((64U - src_bit) - (uint32 )bps);   10416     matchbits = maskbits << ((64U - src_bit) - (uint32 )bps);
10417     s = (tsample_t )0;   10417     s = (tsample_t )0;
10418     while ((int )s < (int )spp) {   10418     while ((int )s < (int )spp) {
10419       src = *(in + s) + src_byte;   10419       src = *(in + s) + src_byte;
10420       if (little_endian) {   10420       if (little_endian) {
10421         swapbuff1[3] = *src;   10421         swapbuff1[3] = *src;
10422         swapbuff1[2] = *(src + 1);   10422         swapbuff1[2] = *(src + 1);
10423         swapbuff1[1] = *(src + 2);   10423         swapbuff1[1] = *(src + 2);
10424         swapbuff1[0] = *(src + 3);   10424         swapbuff1[0] = *(src + 3);
10425       } else {   10425       } else {
10426         swapbuff1[0] = *src;   10426         swapbuff1[0] = *src;
10427         swapbuff1[1] = *(src + 1);   10427         swapbuff1[1] = *(src + 1);
10428         swapbuff1[2] = *(src + 2);   10428         swapbuff1[2] = *(src + 2);
10429         swapbuff1[3] = *(src + 3);   10429         swapbuff1[3] = *(src + 3);
10430       }   10430       }
10431       longbuff1 = *((uint32 *)(swapbuff1));   10431       longbuff1 = *((uint32 *)(swapbuff1));
10432       memset((void *)(swapbuff2), '\000', sizeof(swapbuff2));   10432       memset((void *)(swapbuff2), '\000', sizeof(swapbuff2));
10433       if (little_endian) {   10433       if (little_endian) {
10434         swapbuff2[3] = *src;   10434         swapbuff2[3] = *src;
10435         swapbuff2[2] = *(src + 1);   10435         swapbuff2[2] = *(src + 1);
10436         swapbuff2[1] = *(src + 2);   10436         swapbuff2[1] = *(src + 2);
10437         swapbuff2[0] = *(src + 3);   10437         swapbuff2[0] = *(src + 3);
10438       } else {   10438       } else {
10439         swapbuff2[0] = *src;   10439         swapbuff2[0] = *src;
10440         swapbuff2[1] = *(src + 1);   10440         swapbuff2[1] = *(src + 1);
10441         swapbuff2[2] = *(src + 2);   10441         swapbuff2[2] = *(src + 2);
10442         swapbuff2[3] = *(src + 3);   10442         swapbuff2[3] = *(src + 3);
10443       }   10443       }
10444       longbuff2 = *((uint32 *)(swapbuff2));   10444       longbuff2 = *((uint32 *)(swapbuff2));
10445       buff3 = ((uint64 )longbuff1 << 32) | (unsigned long long )longbuff2;   10445       buff3 = ((uint64 )longbuff1 << 32) | (unsigned long long )longbuff2;
10446       buff1 = (buff3 & matchbits) << src_bit;   10446       buff1 = (buff3 & matchbits) << src_bit;
10447       if (ready_bits >= 32) {   10447       if (ready_bits >= 32) {
10448         bytebuff1 = (uint8 )(buff2 >> 56);   10448         bytebuff1 = (uint8 )(buff2 >> 56);
10449         tmp = dst;   10449         tmp = dst;
10450         dst ++;   10450         dst ++;
10451         *tmp = bytebuff1;   10451         *tmp = bytebuff1;
10452         bytebuff2 = (uint8 )(buff2 >> 48);   10452         bytebuff2 = (uint8 )(buff2 >> 48);
10453         tmp___0 = dst;   10453         tmp___0 = dst;
10454         dst ++;   10454         dst ++;
10455         *tmp___0 = bytebuff2;   10455         *tmp___0 = bytebuff2;
10456         bytebuff3 = (uint8 )(buff2 >> 40);   10456         bytebuff3 = (uint8 )(buff2 >> 40);
10457         tmp___1 = dst;   10457         tmp___1 = dst;
10458         dst ++;   10458         dst ++;
10459         *tmp___1 = bytebuff3;   10459         *tmp___1 = bytebuff3;
10460         bytebuff4 = (uint8 )(buff2 >> 32);   10460         bytebuff4 = (uint8 )(buff2 >> 32);
10461         tmp___2 = dst;   10461         tmp___2 = dst;
10462         dst ++;   10462         dst ++;
10463         *tmp___2 = bytebuff4;   10463         *tmp___2 = bytebuff4;
10464         ready_bits -= 32;   10464         ready_bits -= 32;
10465         buff2 = (buff2 << 32) | (buff1 >> ready_bits);   10465         buff2 = (buff2 << 32) | (buff1 >> ready_bits);
10466         strcpy((char */* __restrict  */)(action),   10466         strcpy((char */* __restrict  */)(action),
10467                (char const   */* __restrict  */)"Flush");   10467                (char const   */* __restrict  */)"Flush");
10468       } else {   10468       } else {
10469         bytebuff4 = (uint8 )0;   10469         bytebuff4 = (uint8 )0;
10470         bytebuff3 = bytebuff4;   10470         bytebuff3 = bytebuff4;
10471         bytebuff2 = bytebuff3;   10471         bytebuff2 = bytebuff3;
10472         bytebuff1 = bytebuff2;   10472         bytebuff1 = bytebuff2;
10473         buff2 |= buff1 >> ready_bits;   10473         buff2 |= buff1 >> ready_bits;
10474         strcpy((char */* __restrict  */)(action),   10474         strcpy((char */* __restrict  */)(action),
10475                (char const   */* __restrict  */)"Update");   10475                (char const   */* __restrict  */)"Update");
10476       }   10476       }
10477       ready_bits += (int )bps;   10477       ready_bits += (int )bps;
10478       if ((unsigned int )dumpfile != (unsigned int )((void *)0)) {   10478       if ((unsigned int )dumpfile != (unsigned int )((void *)0)) {
10479         if (level == 3) {   10479         if (level == 3) {
10480           dump_info(dumpfile, format, (char *)"",   10480           dump_info(dumpfile, format, (char *)"",
10481                     (char *)"Row %3d, Col %3d, Sample %d, Src byte offset %3d  bit offset %2d  Dst offset %3d",   10481                     (char *)"Row %3d, Col %3d, Sample %d, Src byte offset %3d  bit offset %2d  Dst offset %3d",
10482                     row + 1U, col + 1U, (int )s, src_byte, src_bit, dst - out);   10482                     row + 1U, col + 1U, (int )s, src_byte, src_bit, dst - out);
10483           dump_wide(dumpfile, format, (char *)"Match bits ", matchbits);   10483           dump_wide(dumpfile, format, (char *)"Match bits ", matchbits);
10484           dump_data(dumpfile, format, (char *)"Src   bits ", src, (uint32 )8);   10484           dump_data(dumpfile, format, (char *)"Src   bits ", src, (uint32 )8);
10485           dump_wide(dumpfile, format, (char *)"Buff1 bits ", buff1);   10485           dump_wide(dumpfile, format, (char *)"Buff1 bits ", buff1);
10486           dump_wide(dumpfile, format, (char *)"Buff2 bits ", buff2);   10486           dump_wide(dumpfile, format, (char *)"Buff2 bits ", buff2);
10487           dump_info(dumpfile, format, (char *)"",   10487           dump_info(dumpfile, format, (char *)"",
10488                     (char *)"Ready bits:   %d, %s", ready_bits, action);   10488                     (char *)"Ready bits:   %d, %s", ready_bits, action);
10489         } else {   10489         } else {
10490     10490  
10491         }   10491         }
10492       } else {   10492       } else {
10493     10493  
10494       }   10494       }
10495       s = (tsample_t )((int )s + 1);   10495       s = (tsample_t )((int )s + 1);
10496     }   10496     }
10497     col ++;   10497     col ++;
10498   }   10498   }
10499   while (ready_bits > 0) {   10499   while (ready_bits > 0) {
10500     bytebuff1 = (uint8 )(buff2 >> 56);   10500     bytebuff1 = (uint8 )(buff2 >> 56);
10501     tmp___3 = dst;   10501     tmp___3 = dst;
10502     dst ++;   10502     dst ++;
10503     *tmp___3 = bytebuff1;   10503     *tmp___3 = bytebuff1;
10504     buff2 <<= 8;   10504     buff2 <<= 8;
10505     ready_bits -= 8;   10505     ready_bits -= 8;
10506   }   10506   }
10507   if ((unsigned int )dumpfile != (unsigned int )((void *)0)) {   10507   if ((unsigned int )dumpfile != (unsigned int )((void *)0)) {
10508     if (level == 3) {   10508     if (level == 3) {
10509       dump_info(dumpfile, format, (char *)"",   10509       dump_info(dumpfile, format, (char *)"",
10510                 (char *)"Row %3d, Col %3d, Src byte offset %3d  bit offset %2d  Dst offset %3d",   10510                 (char *)"Row %3d, Col %3d, Src byte offset %3d  bit offset %2d  Dst offset %3d",
10511                 row + 1U, col + 1U, src_byte, src_bit, dst - out);   10511                 row + 1U, col + 1U, src_byte, src_bit, dst - out);
10512       dump_long(dumpfile, format, (char *)"Match bits ", (uint32 )matchbits);   10512       dump_long(dumpfile, format, (char *)"Match bits ", (uint32 )matchbits);
10513       dump_data(dumpfile, format, (char *)"Src   bits ", src, (uint32 )4);   10513       dump_data(dumpfile, format, (char *)"Src   bits ", src, (uint32 )4);
10514       dump_long(dumpfile, format, (char *)"Buff1 bits ", (uint32 )buff1);   10514       dump_long(dumpfile, format, (char *)"Buff1 bits ", (uint32 )buff1);
10515       dump_long(dumpfile, format, (char *)"Buff2 bits ", (uint32 )buff2);   10515       dump_long(dumpfile, format, (char *)"Buff2 bits ", (uint32 )buff2);
10516       dump_byte(dumpfile, format, (char *)"Write bits1", bytebuff1);   10516       dump_byte(dumpfile, format, (char *)"Write bits1", bytebuff1);
10517       dump_byte(dumpfile, format, (char *)"Write bits2", bytebuff2);   10517       dump_byte(dumpfile, format, (char *)"Write bits2", bytebuff2);
10518       dump_info(dumpfile, format, (char *)"", (char *)"Ready bits:  %2d",   10518       dump_info(dumpfile, format, (char *)"", (char *)"Ready bits:  %2d",
10519                 ready_bits);   10519                 ready_bits);
10520     } else {   10520     } else {
10521     10521  
10522     }   10522     }
10523   } else {   10523   } else {
10524     10524  
10525   }   10525   }
10526   if ((unsigned int )dumpfile != (unsigned int )((void *)0)) {   10526   if ((unsigned int )dumpfile != (unsigned int )((void *)0)) {
10527     if (level == 2) {   10527     if (level == 2) {
10528       dump_info(dumpfile, format, (char *)"combineSeparateSamples32bits",   10528       dump_info(dumpfile, format, (char *)"combineSeparateSamples32bits",
10529                 (char *)"Output data");   10529                 (char *)"Output data");
10530       dump_buffer(dumpfile, format, (uint32 )1, dst_rowsize, row, out);   10530       dump_buffer(dumpfile, format, (uint32 )1, dst_rowsize, row, out);
10531     } else {   10531     } else {
10532     10532  
10533     }   10533     }
10534   } else {   10534   } else {
10535     10535  
10536   }   10536   }
10537   return (0);   10537   return (0);
10538 }   10538 }
10539 }   10539 }
10540 static int combineSeparateSamplesBytes(unsigned char **srcbuffs ,   10540 static int combineSeparateSamplesBytes(unsigned char **srcbuffs ,
10541                                        unsigned char *out , uint32 row ,   10541                                        unsigned char *out , uint32 row ,
10542                                        uint32 width , unsigned short spp ,   10542                                        uint32 width , unsigned short spp ,
10543                                        uint16 bps , FILE *dumpfile ,   10543                                        uint16 bps , FILE *dumpfile ,
10544                                        int format , int level )   10544                                        int format , int level )
10545 {   10545 {
10546   int i ;   10546   int i ;
10547   int bytes_per_sample ;   10547   int bytes_per_sample ;
10548   int bytes_per_pixel ;   10548   int bytes_per_pixel ;
10549   int dst_rowsize ;   10549   int dst_rowsize ;
10550   int shift_width ;   10550   int shift_width ;
10551   uint32 col ;   10551   uint32 col ;
10552   uint32 col_offset ;   10552   uint32 col_offset ;
10553   unsigned char *src ;   10553   unsigned char *src ;
10554   unsigned char *dst ;   10554   unsigned char *dst ;
10555   tsample_t s ;   10555   tsample_t s ;
10556     10556  
10557   {   10557   {
10558   src = *(srcbuffs + 0);   10558   src = *(srcbuffs + 0);
10559   dst = out;   10559   dst = out;
10560   if ((unsigned int )src == (unsigned int )((void *)0)) {   10560   if ((unsigned int )src == (unsigned int )((void *)0)) {
10561     TIFFError("combineSeparateSamplesBytes", "Invalid buffer address");   10561     TIFFError("combineSeparateSamplesBytes", "Invalid buffer address");
10562     return (1);   10562     return (1);
10563   } else   10563   } else
10564   if ((unsigned int )dst == (unsigned int )((void *)0)) {   10564   if ((unsigned int )dst == (unsigned int )((void *)0)) {
10565     TIFFError("combineSeparateSamplesBytes", "Invalid buffer address");   10565     TIFFError("combineSeparateSamplesBytes", "Invalid buffer address");
10566     return (1);   10566     return (1);
10567   } else {   10567   } else {
10568     10568  
10569   }   10569   }
10570   bytes_per_sample = ((int )bps + 7) / 8;   10570   bytes_per_sample = ((int )bps + 7) / 8;
10571   bytes_per_pixel = ((int )bps * (int )spp + 7) / 8;   10571   bytes_per_pixel = ((int )bps * (int )spp + 7) / 8;
10572   if (bytes_per_pixel < bytes_per_sample + 1) {   10572   if (bytes_per_pixel < bytes_per_sample + 1) {
10573     shift_width = bytes_per_sample;   10573     shift_width = bytes_per_sample;
10574   } else {   10574   } else {
10575     shift_width = bytes_per_pixel;   10575     shift_width = bytes_per_pixel;
10576   }   10576   }
10577   if ((unsigned int )dumpfile != (unsigned int )((void *)0)) {   10577   if ((unsigned int )dumpfile != (unsigned int )((void *)0)) {
10578     if (level == 2) {   10578     if (level == 2) {
10579       s = (tsample_t )0;   10579       s = (tsample_t )0;
10580       while ((int )s < (int )spp) {   10580       while ((int )s < (int )spp) {
10581         dump_info(dumpfile, format, (char *)"combineSeparateSamplesBytes",   10581         dump_info(dumpfile, format, (char *)"combineSeparateSamplesBytes",
10582                   (char *)"Input data, Sample %d", (int )s);   10582                   (char *)"Input data, Sample %d", (int )s);
10583         dump_buffer(dumpfile, format, (uint32 )1, width, row, *(srcbuffs + s));   10583         dump_buffer(dumpfile, format, (uint32 )1, width, row, *(srcbuffs + s));
10584         s = (tsample_t )((int )s + 1);   10584         s = (tsample_t )((int )s + 1);
10585       }   10585       }
10586     } else {   10586     } else {
10587     10587  
10588     }   10588     }
10589   } else {   10589   } else {
10590     10590  
10591   }   10591   }
10592   dst_rowsize = (int )(((uint32 )((int )bps * (int )spp) * width + 7U) / 8U);   10592   dst_rowsize = (int )(((uint32 )((int )bps * (int )spp) * width + 7U) / 8U);
10593   col = (uint32 )0;   10593   col = (uint32 )0;
10594   while (col < width) {   10594   while (col < width) {
10595     col_offset = col * (uint32 )((int )bps / 8);   10595     col_offset = col * (uint32 )((int )bps / 8);
10596     s = (tsample_t )0;   10596     s = (tsample_t )0;
10597     while (1) {   10597     while (1) {
10598       if ((int )s < (int )spp) {   10598       if ((int )s < (int )spp) {
10599         if ((int )s < 8) {   10599         if ((int )s < 8) {
10600     10600  
10601         } else {   10601         } else {
10602           break;   10602           break;
10603         }   10603         }
10604       } else {   10604       } else {
10605         break;   10605         break;
10606       }   10606       }
10607       src = *(srcbuffs + s) + col_offset;   10607       src = *(srcbuffs + s) + col_offset;
10608       i = 0;   10608       i = 0;
10609       while (i < bytes_per_sample) {   10609       while (i < bytes_per_sample) {
10610         *(dst + i) = *(src + i);   10610         *(dst + i) = *(src + i);
10611         i ++;   10611         i ++;
10612       }   10612       }
10613       src += bytes_per_sample;   10613       src += bytes_per_sample;
10614       dst += bytes_per_sample;   10614       dst += bytes_per_sample;
10615       s = (tsample_t )((int )s + 1);   10615       s = (tsample_t )((int )s + 1);
10616     }   10616     }
10617     col ++;   10617     col ++;
10618   }   10618   }
10619   if ((unsigned int )dumpfile != (unsigned int )((void *)0)) {   10619   if ((unsigned int )dumpfile != (unsigned int )((void *)0)) {
10620     if (level == 2) {   10620     if (level == 2) {
10621       dump_info(dumpfile, format, (char *)"combineSeparateSamplesBytes",   10621       dump_info(dumpfile, format, (char *)"combineSeparateSamplesBytes",
10622                 (char *)"Output data, combined samples");   10622                 (char *)"Output data, combined samples");
10623       dump_buffer(dumpfile, format, (uint32 )1, (uint32 )dst_rowsize, row, out);   10623       dump_buffer(dumpfile, format, (uint32 )1, (uint32 )dst_rowsize, row, out);
10624     } else {   10624     } else {
10625     10625  
10626     }   10626     }
10627   } else {   10627   } else {
10628     10628  
10629   }   10629   }
10630   return (0);   10630   return (0);
10631 }   10631 }
10632 }   10632 }
10633 static int readSeparateStripsIntoBuffer(TIFF *in , uint8 *obuf , uint32 length ,   10633 static int readSeparateStripsIntoBuffer(TIFF *in , uint8 *obuf , uint32 length ,
10634                                         uint32 width , unsigned short spp ,   10634                                         uint32 width , unsigned short spp ,
10635                                         struct dump_opts *dump )   10635                                         struct dump_opts *dump )
10636 {   10636 {
10637   int i ;   10637   int i ;
10638   int bytes_per_sample ;   10638   int bytes_per_sample ;
10639   int bytes_per_pixel ;   10639   int bytes_per_pixel ;
10640   int shift_width ;   10640   int shift_width ;
10641   uint16 bps ;   10641   uint16 bps ;
10642   uint32 row ;   10642   uint32 row ;
10643   uint32 src_rowsize ;   10643   uint32 src_rowsize ;
10644   uint32 dst_rowsize ;   10644   uint32 dst_rowsize ;
10645   tsample_t s ;   10645   tsample_t s ;
10646   tsize_t scanlinesize ;   10646   tsize_t scanlinesize ;
10647   tmsize_t tmp ;   10647   tmsize_t tmp ;
10648   unsigned char *srcbuffs[8] ;   10648   unsigned char *srcbuffs[8] ;
10649   unsigned char *buff ;   10649   unsigned char *buff ;
10650   unsigned char *dst ;   10650   unsigned char *dst ;
10651   void *tmp___0 ;   10651   void *tmp___0 ;
10652   char const   *tmp___1 ;   10652   char const   *tmp___1 ;
10653   int tmp___2 ;   10653   int tmp___2 ;
10654   int tmp___3 ;   10654   int tmp___3 ;
10655   int tmp___4 ;   10655   int tmp___4 ;
10656   int tmp___5 ;   10656   int tmp___5 ;
10657   int tmp___6 ;   10657   int tmp___6 ;
10658   int tmp___7 ;   10658   int tmp___7 ;
10659     10659  
10660   {   10660   {
10661   tmp = TIFFScanlineSize(in);   10661   tmp = TIFFScanlineSize(in);
10662   scanlinesize = tmp;   10662   scanlinesize = tmp;
10663   buff = (unsigned char *)((void *)0);   10663   buff = (unsigned char *)((void *)0);
10664   dst = (unsigned char *)((void *)0);   10664   dst = (unsigned char *)((void *)0);
10665   TIFFGetField(in, (uint32 )258, & bps);   10665   TIFFGetField(in, (uint32 )258, & bps);
10666   if ((unsigned int )obuf == (unsigned int )((void *)0)) {   10666   if ((unsigned int )obuf == (unsigned int )((void *)0)) {
10667     TIFFError("readSeparateStripsIntoBuffer", "Invalid buffer argument");   10667     TIFFError("readSeparateStripsIntoBuffer", "Invalid buffer argument");
10668     return (0);   10668     return (0);
10669   } else {   10669   } else {
10670     10670  
10671   }   10671   }
10672   bytes_per_sample = ((int )bps + 7) / 8;   10672   bytes_per_sample = ((int )bps + 7) / 8;
10673   bytes_per_pixel = ((int )bps * (int )spp + 7) / 8;   10673   bytes_per_pixel = ((int )bps * (int )spp + 7) / 8;
10674   if (bytes_per_pixel < bytes_per_sample + 1) {   10674   if (bytes_per_pixel < bytes_per_sample + 1) {
10675     shift_width = bytes_per_pixel;   10675     shift_width = bytes_per_pixel;
10676   } else {   10676   } else {
10677     shift_width = bytes_per_sample + 1;   10677     shift_width = bytes_per_sample + 1;
10678   }   10678   }
10679   src_rowsize = ((uint32 )bps * width + 7U) / 8U;   10679   src_rowsize = ((uint32 )bps * width + 7U) / 8U;
10680   dst_rowsize = (((uint32 )bps * width) * (uint32 )spp + 7U) / 8U;   10680   dst_rowsize = (((uint32 )bps * width) * (uint32 )spp + 7U) / 8U;
10681   dst = obuf;   10681   dst = obuf;
10682   if ((unsigned int )dump->infile != (unsigned int )((void *)0)) {   10682   if ((unsigned int )dump->infile != (unsigned int )((void *)0)) {
10683     if (dump->level == 3) {   10683     if (dump->level == 3) {
10684       dump_info(dump->infile, dump->format, (char *)"",   10684       dump_info(dump->infile, dump->format, (char *)"",
10685                 (char *)"Image width %d, length %d, Scanline size, %4d bytes",   10685                 (char *)"Image width %d, length %d, Scanline size, %4d bytes",
10686                 width, length, scanlinesize);   10686                 width, length, scanlinesize);
10687       dump_info(dump->infile, dump->format, (char *)"",   10687       dump_info(dump->infile, dump->format, (char *)"",
10688                 (char *)"Bits per sample %d, Samples per pixel %d, Shift width %d",   10688                 (char *)"Bits per sample %d, Samples per pixel %d, Shift width %d",
10689                 (int )bps, (int )spp, shift_width);   10689                 (int )bps, (int )spp, shift_width);
10690     } else {   10690     } else {
10691     10691  
10692     }   10692     }
10693   } else {   10693   } else {
10694     10694  
10695   }   10695   }
10696   s = (tsample_t )0;   10696   s = (tsample_t )0;
10697   while (1) {   10697   while (1) {
10698     if ((int )s < (int )spp) {   10698     if ((int )s < (int )spp) {
10699       if ((int )s < 8) {   10699       if ((int )s < 8) {
10700     10700  
10701       } else {   10701       } else {
10702         break;   10702         break;
10703       }   10703       }
10704     } else {   10704     } else {
10705       break;   10705       break;
10706     }   10706     }
10707     srcbuffs[s] = (unsigned char *)((void *)0);   10707     srcbuffs[s] = (unsigned char *)((void *)0);
10708     tmp___0 = _TIFFmalloc((tmsize_t )src_rowsize);   10708     tmp___0 = _TIFFmalloc((tmsize_t )src_rowsize);
10709     buff = (unsigned char *)tmp___0;   10709     buff = (unsigned char *)tmp___0;
10710     if (! buff) {   10710     if (! buff) {
10711       TIFFError("readSeparateStripsIntoBuffer",   10711       TIFFError("readSeparateStripsIntoBuffer",
10712                 "Unable to allocate read buffer for sample %d", (int )s);   10712                 "Unable to allocate read buffer for sample %d", (int )s);
10713       i = 0;   10713       i = 0;
10714       while (i < (int )s) {   10714       while (i < (int )s) {
10715         _TIFFfree((void *)srcbuffs[i]);   10715         _TIFFfree((void *)srcbuffs[i]);
10716         i ++;   10716         i ++;
10717       }   10717       }
10718       return (0);   10718       return (0);
10719     } else {   10719     } else {
10720     10720  
10721     }   10721     }
10722     srcbuffs[s] = buff;   10722     srcbuffs[s] = buff;
10723     s = (tsample_t )((int )s + 1);   10723     s = (tsample_t )((int )s + 1);
10724   }   10724   }
10725   row = (uint32 )0;   10725   row = (uint32 )0;
10726   while (row < length) {   10726   while (row < length) {
10727     s = (tsample_t )0;   10727     s = (tsample_t )0;
10728     while (1) {   10728     while (1) {
10729       if ((int )s < (int )spp) {   10729       if ((int )s < (int )spp) {
10730         if ((int )s < 8) {   10730         if ((int )s < 8) {
10731     10731  
10732         } else {   10732         } else {
10733           break;   10733           break;
10734         }   10734         }
10735       } else {   10735       } else {
10736         break;   10736         break;
10737       }   10737       }
10738       buff = srcbuffs[s];   10738       buff = srcbuffs[s];
10739       tmp___2 = TIFFReadScanline(in, (void *)buff, row, s);   10739       tmp___2 = TIFFReadScanline(in, (void *)buff, row, s);
10740       if (tmp___2 < 0) {   10740       if (tmp___2 < 0) {
10741         if (! ignore) {   10741         if (! ignore) {
10742           tmp___1 = TIFFFileName(in);   10742           tmp___1 = TIFFFileName(in);
10743           TIFFError(tmp___1, "Error, can\'t read scanline %lu for sample %d",   10743           TIFFError(tmp___1, "Error, can\'t read scanline %lu for sample %d",
10744                     (unsigned long )row, (int )s + 1);   10744                     (unsigned long )row, (int )s + 1);
10745           i = 0;   10745           i = 0;
10746           while (i < (int )s) {   10746           while (i < (int )s) {
10747             _TIFFfree((void *)srcbuffs[i]);   10747             _TIFFfree((void *)srcbuffs[i]);
10748             i ++;   10748             i ++;
10749           }   10749           }
10750           return (0);   10750           return (0);
10751         } else {   10751         } else {
10752     10752  
10753         }   10753         }
10754       } else {   10754       } else {
10755     10755  
10756       }   10756       }
10757       s = (tsample_t )((int )s + 1);   10757       s = (tsample_t )((int )s + 1);
10758     }   10758     }
10759     dst = obuf + row * dst_rowsize;   10759     dst = obuf + row * dst_rowsize;
10760     if ((int )bps % 8 == 0) {   10760     if ((int )bps % 8 == 0) {
10761       tmp___3 = combineSeparateSamplesBytes(srcbuffs, dst, row, width, spp, bps,   10761       tmp___3 = combineSeparateSamplesBytes(srcbuffs, dst, row, width, spp, bps,
10762                                             dump->infile, dump->format,   10762                                             dump->infile, dump->format,
10763                                             dump->level);   10763                                             dump->level);
10764       if (tmp___3) {   10764       if (tmp___3) {
10765         i = 0;   10765         i = 0;
10766         while (i < (int )spp) {   10766         while (i < (int )spp) {
10767           _TIFFfree((void *)srcbuffs[i]);   10767           _TIFFfree((void *)srcbuffs[i]);
10768           i ++;   10768           i ++;
10769         }   10769         }
10770         return (0);   10770         return (0);
10771       } else {   10771       } else {
10772     10772  
10773       }   10773       }
10774     } else {   10774     } else {
10775       switch (shift_width) {   10775       switch (shift_width) {
10776       case 1:   10776       case 1:
10777       tmp___4 = combineSeparateSamples8bits(srcbuffs, dst, row, width, spp, bps,   10777       tmp___4 = combineSeparateSamples8bits(srcbuffs, dst, row, width, spp, bps,
10778                                             dump->infile, dump->format,   10778                                             dump->infile, dump->format,
10779                                             dump->level);   10779                                             dump->level);
10780       if (tmp___4) {   10780       if (tmp___4) {
10781         i = 0;   10781         i = 0;
10782         while (i < (int )spp) {   10782         while (i < (int )spp) {
10783           _TIFFfree((void *)srcbuffs[i]);   10783           _TIFFfree((void *)srcbuffs[i]);
10784           i ++;   10784           i ++;
10785         }   10785         }
10786         return (0);   10786         return (0);
10787       } else {   10787       } else {
10788     10788  
10789       }   10789       }
10790       break;   10790       break;
10791       case 2:   10791       case 2:
10792       tmp___5 = combineSeparateSamples16bits(srcbuffs, dst, row, width, spp,   10792       tmp___5 = combineSeparateSamples16bits(srcbuffs, dst, row, width, spp,
10793                                              bps, dump->infile, dump->format,   10793                                              bps, dump->infile, dump->format,
10794                                              dump->level);   10794                                              dump->level);
10795       if (tmp___5) {   10795       if (tmp___5) {
10796         i = 0;   10796         i = 0;
10797         while (i < (int )spp) {   10797         while (i < (int )spp) {
10798           _TIFFfree((void *)srcbuffs[i]);   10798           _TIFFfree((void *)srcbuffs[i]);
10799           i ++;   10799           i ++;
10800         }   10800         }
10801         return (0);   10801         return (0);
10802       } else {   10802       } else {
10803     10803  
10804       }   10804       }
10805       break;   10805       break;
10806       case 3:   10806       case 3:
10807       tmp___6 = combineSeparateSamples24bits(srcbuffs, dst, row, width, spp,   10807       tmp___6 = combineSeparateSamples24bits(srcbuffs, dst, row, width, spp,
10808                                              bps, dump->infile, dump->format,   10808                                              bps, dump->infile, dump->format,
10809                                              dump->level);   10809                                              dump->level);
10810       if (tmp___6) {   10810       if (tmp___6) {
10811         i = 0;   10811         i = 0;
10812         while (i < (int )spp) {   10812         while (i < (int )spp) {
10813           _TIFFfree((void *)srcbuffs[i]);   10813           _TIFFfree((void *)srcbuffs[i]);
10814           i ++;   10814           i ++;
10815         }   10815         }
10816         return (0);   10816         return (0);
10817       } else {   10817       } else {
10818     10818  
10819       }   10819       }
10820       break;   10820       break;
10821       case 8:   10821       case 8:
10822       case 7:   10822       case 7:
10823       case 6:   10823       case 6:
10824       case 5:   10824       case 5:
10825       case 4:   10825       case 4:
10826       tmp___7 = combineSeparateSamples32bits(srcbuffs, dst, row, width, spp,   10826       tmp___7 = combineSeparateSamples32bits(srcbuffs, dst, row, width, spp,
10827                                              bps, dump->infile, dump->format,   10827                                              bps, dump->infile, dump->format,
10828                                              dump->level);   10828                                              dump->level);
10829       if (tmp___7) {   10829       if (tmp___7) {
10830         i = 0;   10830         i = 0;
10831         while (i < (int )spp) {   10831         while (i < (int )spp) {
10832           _TIFFfree((void *)srcbuffs[i]);   10832           _TIFFfree((void *)srcbuffs[i]);
10833           i ++;   10833           i ++;
10834         }   10834         }
10835         return (0);   10835         return (0);
10836       } else {   10836       } else {
10837     10837  
10838       }   10838       }
10839       break;   10839       break;
10840       default:   10840       default:
10841       TIFFError("readSeparateStripsIntoBuffer", "Unsupported bit depth: %d",   10841       TIFFError("readSeparateStripsIntoBuffer", "Unsupported bit depth: %d",
10842                 (int )bps);   10842                 (int )bps);
10843       i = 0;   10843       i = 0;
10844       while (i < (int )spp) {   10844       while (i < (int )spp) {
10845         _TIFFfree((void *)srcbuffs[i]);   10845         _TIFFfree((void *)srcbuffs[i]);
10846         i ++;   10846         i ++;
10847       }   10847       }
10848       return (0);   10848       return (0);
10849       }   10849       }
10850     }   10850     }
10851     row ++;   10851     row ++;
10852   }   10852   }
10853   s = (tsample_t )0;   10853   s = (tsample_t )0;
10854   while (1) {   10854   while (1) {
10855     if ((int )s < (int )spp) {   10855     if ((int )s < (int )spp) {
10856       if ((int )s < 8) {   10856       if ((int )s < 8) {
10857     10857  
10858       } else {   10858       } else {
10859         break;   10859         break;
10860       }   10860       }
10861     } else {   10861     } else {
10862       break;   10862       break;
10863     }   10863     }
10864     buff = srcbuffs[s];   10864     buff = srcbuffs[s];
10865     if ((unsigned int )buff != (unsigned int )((void *)0)) {   10865     if ((unsigned int )buff != (unsigned int )((void *)0)) {
10866       _TIFFfree((void *)buff);   10866       _TIFFfree((void *)buff);
10867     } else {   10867     } else {
10868     10868  
10869     }   10869     }
10870     s = (tsample_t )((int )s + 1);   10870     s = (tsample_t )((int )s + 1);
10871   }   10871   }
10872   return (1);   10872   return (1);
10873 }   10873 }
10874 }   10874 }
10875 static int get_page_geometry(char *name , struct pagedef *page )   10875 static int get_page_geometry(char *name , struct pagedef *page )
10876 {   10876 {
10877   char *ptr ;   10877   char *ptr ;
10878   int n ;   10878   int n ;
10879   int __res ;   10879   int __res ;
10880   int __c ;   10880   int __c ;
10881   __int32_t const   **tmp ;   10881   __int32_t const   **tmp ;
10882   __int32_t const   **tmp___0 ;   10882   __int32_t const   **tmp___0 ;
10883   size_t __s1_len ;   10883   size_t __s1_len ;
10884   size_t __s2_len ;   10884   size_t __s2_len ;
10885   int tmp___1 ;   10885   int tmp___1 ;
10886   int tmp___2 ;   10886   int tmp___2 ;
10887   int tmp___3 ;   10887   int tmp___3 ;
10888   unsigned char const   *__s2 ;   10888   unsigned char const   *__s2 ;
10889   register int __result ;   10889   register int __result ;
10890   int tmp___4 ;   10890   int tmp___4 ;
10891   unsigned char const   *__s1 ;   10891   unsigned char const   *__s1 ;
10892   register int __result___0 ;   10892   register int __result___0 ;
10893   int tmp___5 ;   10893   int tmp___5 ;
10894   int tmp___6 ;   10894   int tmp___6 ;
10895   int tmp___7 ;   10895   int tmp___7 ;
10896     10896  
10897   {   10897   {
10898   ptr = name;   10898   ptr = name;
10899   while (*ptr) {   10899   while (*ptr) {
10900     if (sizeof((int )*ptr) > 1U) {   10900     if (sizeof((int )*ptr) > 1U) {
10901       __res = tolower((int )*ptr);   10901       __res = tolower((int )*ptr);
10902     } else {   10902     } else {
10903       tmp___0 = __ctype_tolower_loc();   10903       tmp___0 = __ctype_tolower_loc();
10904       __res = (int )*(*tmp___0 + (int )*ptr);   10904       __res = (int )*(*tmp___0 + (int )*ptr);
10905     }   10905     }
10906     *ptr = (char )__res;   10906     *ptr = (char )__res;
10907     ptr ++;   10907     ptr ++;
10908   }   10908   }
10909   n = 0;   10909   n = 0;
10910   while (n < 49) {   10910   while (n < 49) {
10911     if (0) {   10911     if (0) {
10912       __s1_len = strlen((char const   *)name);   10912       __s1_len = strlen((char const   *)name);
10913       __s2_len = strlen((char const   *)(PaperTable[n].name));   10913       __s2_len = strlen((char const   *)(PaperTable[n].name));
10914       if (! ((size_t )((void const   *)(name + 1)) - (size_t )((void const   *)name) == 1U)) {   10914       if (! ((size_t )((void const   *)(name + 1)) - (size_t )((void const   *)name) == 1U)) {
10915         goto _L___0;   10915         goto _L___0;
10916       } else   10916       } else
10917       if (__s1_len >= 4U) {   10917       if (__s1_len >= 4U) {
10918         _L___0: /* CIL Label */   10918         _L___0: /* CIL Label */
10919         if (! ((size_t )((void const   *)(PaperTable[n].name + 1)) - (size_t )((void const   *)(PaperTable[n].name)) == 1U)) {   10919         if (! ((size_t )((void const   *)(PaperTable[n].name + 1)) - (size_t )((void const   *)(PaperTable[n].name)) == 1U)) {
10920           tmp___7 = 1;   10920           tmp___7 = 1;
10921         } else   10921         } else
10922         if (__s2_len >= 4U) {   10922         if (__s2_len >= 4U) {
10923           tmp___7 = 1;   10923           tmp___7 = 1;
10924         } else {   10924         } else {
10925           tmp___7 = 0;   10925           tmp___7 = 0;
10926         }   10926         }
10927       } else {   10927       } else {
10928         tmp___7 = 0;   10928         tmp___7 = 0;
10929       }   10929       }
10930       if (tmp___7) {   10930       if (tmp___7) {
10931         tmp___2 = __builtin_strcmp((char const   *)name,   10931         tmp___2 = __builtin_strcmp((char const   *)name,
10932                                    (char const   *)(PaperTable[n].name));   10932                                    (char const   *)(PaperTable[n].name));
10933         tmp___6 = tmp___2;   10933         tmp___6 = tmp___2;
10934       } else {   10934       } else {
10935         tmp___5 = __builtin_strcmp((char const   *)name,   10935         tmp___5 = __builtin_strcmp((char const   *)name,
10936                                    (char const   *)(PaperTable[n].name));   10936                                    (char const   *)(PaperTable[n].name));
10937         tmp___6 = tmp___5;   10937         tmp___6 = tmp___5;
10938       }   10938       }
10939     } else {   10939     } else {
10940       tmp___5 = __builtin_strcmp((char const   *)name,   10940       tmp___5 = __builtin_strcmp((char const   *)name,
10941                                  (char const   *)(PaperTable[n].name));   10941                                  (char const   *)(PaperTable[n].name));
10942       tmp___6 = tmp___5;   10942       tmp___6 = tmp___5;
10943     }   10943     }
10944     if (tmp___6 == 0) {   10944     if (tmp___6 == 0) {
10945       page->width = PaperTable[n].width;   10945       page->width = PaperTable[n].width;
10946       page->length = PaperTable[n].length;   10946       page->length = PaperTable[n].length;
10947       __builtin_strncpy(page->name, (char const   *)(PaperTable[n].name), 15U);   10947       __builtin_strncpy(page->name, (char const   *)(PaperTable[n].name), 15U);
10948       page->name[15] = (char )'\000';   10948       page->name[15] = (char )'\000';
10949       return (0);   10949       return (0);
10950     } else {   10950     } else {
10951     10951  
10952     }   10952     }
10953     n ++;   10953     n ++;
10954   }   10954   }
10955   return (1);   10955   return (1);
10956 }   10956 }
10957 }   10957 }
10958 static void initPageSetup(struct pagedef *page , struct pageseg *pagelist ,   10958 static void initPageSetup(struct pagedef *page , struct pageseg *pagelist ,
10959                           struct buffinfo *seg_buffs )   10959                           struct buffinfo *seg_buffs )
10960 {   10960 {
10961   int i ;   10961   int i ;
10962     10962  
10963   {   10963   {
10964   strcpy((char */* __restrict  */)(page->name),   10964   strcpy((char */* __restrict  */)(page->name),
10965          (char const   */* __restrict  */)"");   10965          (char const   */* __restrict  */)"");
10966   page->mode = (uint32 )0;   10966   page->mode = (uint32 )0;
10967   page->res_unit = (uint16 )1;   10967   page->res_unit = (uint16 )1;
10968   page->hres = 0.0;   10968   page->hres = 0.0;
10969   page->vres = 0.0;   10969   page->vres = 0.0;
10970   page->width = 0.0;   10970   page->width = 0.0;
10971   page->length = 0.0;   10971   page->length = 0.0;
10972   page->hmargin = 0.0;   10972   page->hmargin = 0.0;
10973   page->vmargin = 0.0;   10973   page->vmargin = 0.0;
10974   page->rows = 0U;   10974   page->rows = 0U;
10975   page->cols = 0U;   10975   page->cols = 0U;
10976   page->orient = 0U;   10976   page->orient = 0U;
10977   i = 0;   10977   i = 0;
10978   while (i < 32) {   10978   while (i < 32) {
10979     (pagelist + i)->x1 = (uint32 )0;   10979     (pagelist + i)->x1 = (uint32 )0;
10980     (pagelist + i)->x2 = (uint32 )0;   10980     (pagelist + i)->x2 = (uint32 )0;
10981     (pagelist + i)->y1 = (uint32 )0;   10981     (pagelist + i)->y1 = (uint32 )0;
10982     (pagelist + i)->y2 = (uint32 )0;   10982     (pagelist + i)->y2 = (uint32 )0;
10983     (pagelist + i)->buffsize = (uint32 )0;   10983     (pagelist + i)->buffsize = (uint32 )0;
10984     (pagelist + i)->position = 0;   10984     (pagelist + i)->position = 0;
10985     (pagelist + i)->total = 0;   10985     (pagelist + i)->total = 0;
10986     i ++;   10986     i ++;
10987   }   10987   }
10988   i = 0;   10988   i = 0;
10989   while (i < 8) {   10989   while (i < 8) {
10990     (seg_buffs + i)->size = (uint32 )0;   10990     (seg_buffs + i)->size = (uint32 )0;
10991     (seg_buffs + i)->buffer = (unsigned char *)((void *)0);   10991     (seg_buffs + i)->buffer = (unsigned char *)((void *)0);
10992     i ++;   10992     i ++;
10993   }   10993   }
10994   return;   10994   return;
10995 }   10995 }
10996 }   10996 }
10997 static void initImageData(struct image_data *image )   10997 static void initImageData(struct image_data *image )
10998 {   10998 {
10999     10999  
11000     11000  
11001   {   11001   {
11002   image->xres = (float )0.0;   11002   image->xres = (float )0.0;
11003   image->yres = (float )0.0;   11003   image->yres = (float )0.0;
11004   image->width = (uint32 )0;   11004   image->width = (uint32 )0;
11005   image->length = (uint32 )0;   11005   image->length = (uint32 )0;
11006   image->res_unit = (uint16 )1;   11006   image->res_unit = (uint16 )1;
11007   image->bps = (uint16 )0;   11007   image->bps = (uint16 )0;
11008   image->spp = (uint16 )0;   11008   image->spp = (uint16 )0;
11009   image->planar = (uint16 )0;   11009   image->planar = (uint16 )0;
11010   image->photometric = (uint16 )0;   11010   image->photometric = (uint16 )0;
11011   image->orientation = (uint16 )0;   11011   image->orientation = (uint16 )0;
11012   image->adjustments = (uint16 )0;   11012   image->adjustments = (uint16 )0;
11013   return;   11013   return;
11014 }   11014 }
11015 }   11015 }
11016 static void initCropMasks(struct crop_mask *cps )   11016 static void initCropMasks(struct crop_mask *cps )
11017 {   11017 {
11018   int i ;   11018   int i ;
11019     11019  
11020   {   11020   {
11021   cps->crop_mode = (uint16 )0;   11021   cps->crop_mode = (uint16 )0;
11022   cps->res_unit = (uint16 )1;   11022   cps->res_unit = (uint16 )1;
11023   cps->edge_ref = (uint16 )1;   11023   cps->edge_ref = (uint16 )1;
11024   cps->width = (double )0;   11024   cps->width = (double )0;
11025   cps->length = (double )0;   11025   cps->length = (double )0;
11026   i = 0;   11026   i = 0;
11027   while (i < 4) {   11027   while (i < 4) {
11028     cps->margins[i] = 0.0;   11028     cps->margins[i] = 0.0;
11029     i ++;   11029     i ++;
11030   }   11030   }
11031   cps->bufftotal = (uint32 )0;   11031   cps->bufftotal = (uint32 )0;
11032   cps->combined_width = (uint32 )0;   11032   cps->combined_width = (uint32 )0;
11033   cps->combined_length = (uint32 )0;   11033   cps->combined_length = (uint32 )0;
11034   cps->rotation = (uint16 )0;   11034   cps->rotation = (uint16 )0;
11035   cps->photometric = (uint16 )11;   11035   cps->photometric = (uint16 )11;
11036   cps->mirror = (uint16 )0;   11036   cps->mirror = (uint16 )0;
11037   cps->invert = (uint16 )0;   11037   cps->invert = (uint16 )0;
11038   cps->zones = (uint16 )((uint32 )0);   11038   cps->zones = (uint16 )((uint32 )0);
11039   cps->regions = (uint16 )((uint32 )0);   11039   cps->regions = (uint16 )((uint32 )0);
11040   i = 0;   11040   i = 0;
11041   while (i < 8) {   11041   while (i < 8) {
11042     cps->corners[i].X1 = 0.0;   11042     cps->corners[i].X1 = 0.0;
11043     cps->corners[i].X2 = 0.0;   11043     cps->corners[i].X2 = 0.0;
11044     cps->corners[i].Y1 = 0.0;   11044     cps->corners[i].Y1 = 0.0;
11045     cps->corners[i].Y2 = 0.0;   11045     cps->corners[i].Y2 = 0.0;
11046     cps->regionlist[i].x1 = (uint32 )0;   11046     cps->regionlist[i].x1 = (uint32 )0;
11047     cps->regionlist[i].x2 = (uint32 )0;   11047     cps->regionlist[i].x2 = (uint32 )0;
11048     cps->regionlist[i].y1 = (uint32 )0;   11048     cps->regionlist[i].y1 = (uint32 )0;
11049     cps->regionlist[i].y2 = (uint32 )0;   11049     cps->regionlist[i].y2 = (uint32 )0;
11050     cps->regionlist[i].width = (uint32 )0;   11050     cps->regionlist[i].width = (uint32 )0;
11051     cps->regionlist[i].length = (uint32 )0;   11051     cps->regionlist[i].length = (uint32 )0;
11052     cps->regionlist[i].buffsize = (uint32 )0;   11052     cps->regionlist[i].buffsize = (uint32 )0;
11053     cps->regionlist[i].buffptr = (unsigned char *)((void *)0);   11053     cps->regionlist[i].buffptr = (unsigned char *)((void *)0);
11054     cps->zonelist[i].position = 0;   11054     cps->zonelist[i].position = 0;
11055     cps->zonelist[i].total = 0;   11055     cps->zonelist[i].total = 0;
11056     i ++;   11056     i ++;
11057   }   11057   }
11058   cps->exp_mode = (uint16 )0;   11058   cps->exp_mode = (uint16 )0;
11059   cps->img_mode = (uint16 )0;   11059   cps->img_mode = (uint16 )0;
11060   return;   11060   return;
11061 }   11061 }
11062 }   11062 }
11063 static void initDumpOptions(struct dump_opts *dump )   11063 static void initDumpOptions(struct dump_opts *dump )
11064 {   11064 {
11065     11065  
11066     11066  
11067   {   11067   {
11068   dump->debug = 0;   11068   dump->debug = 0;
11069   dump->format = 0;   11069   dump->format = 0;
11070   dump->level = 1;   11070   dump->level = 1;
11071   sprintf((char */* __restrict  */)(dump->mode),   11071   sprintf((char */* __restrict  */)(dump->mode),
11072           (char const   */* __restrict  */)"w");   11072           (char const   */* __restrict  */)"w");
11073   memset((void *)(dump->infilename), '\000', (size_t )4097);   11073   memset((void *)(dump->infilename), '\000', (size_t )4097);
11074   memset((void *)(dump->outfilename), '\000', (size_t )4097);   11074   memset((void *)(dump->outfilename), '\000', (size_t )4097);
11075   dump->infile = (FILE *)((void *)0);   11075   dump->infile = (FILE *)((void *)0);
11076   dump->outfile = (FILE *)((void *)0);   11076   dump->outfile = (FILE *)((void *)0);
11077   return;   11077   return;
11078 }   11078 }
11079 }   11079 }
11080 static int computeInputPixelOffsets(struct crop_mask *crop ,   11080 static int computeInputPixelOffsets(struct crop_mask *crop ,
11081                                     struct image_data *image ,   11081                                     struct image_data *image ,
11082                                     struct offset *off )   11082                                     struct offset *off )
11083 {   11083 {
11084   double scale ;   11084   double scale ;
11085   float xres ;   11085   float xres ;
11086   float yres ;   11086   float yres ;
11087   uint32 tmargin ;   11087   uint32 tmargin ;
11088   uint32 bmargin ;   11088   uint32 bmargin ;
11089   uint32 lmargin ;   11089   uint32 lmargin ;
11090   uint32 rmargin ;   11090   uint32 rmargin ;
11091   uint32 startx ;   11091   uint32 startx ;
11092   uint32 endx ;   11092   uint32 endx ;
11093   uint32 starty ;   11093   uint32 starty ;
11094   uint32 endy ;   11094   uint32 endy ;
11095   uint32 width ;   11095   uint32 width ;
11096   uint32 length ;   11096   uint32 length ;
11097   uint32 crop_width ;   11097   uint32 crop_width ;
11098   uint32 crop_length ;   11098   uint32 crop_length ;
11099   uint32 i ;   11099   uint32 i ;
11100   uint32 max_width ;   11100   uint32 max_width ;
11101   uint32 max_length ;   11101   uint32 max_length ;
11102   uint32 zwidth ;   11102   uint32 zwidth ;
11103   uint32 zlength ;   11103   uint32 zlength ;
11104   uint32 buffsize ;   11104   uint32 buffsize ;
11105   uint32 x1 ;   11105   uint32 x1 ;
11106   uint32 x2 ;   11106   uint32 x2 ;
11107   uint32 y1___0 ;   11107   uint32 y1___0 ;
11108   uint32 y2 ;   11108   uint32 y2 ;
11109     11109  
11110   {   11110   {
11111   if ((int )image->res_unit != 2) {   11111   if ((int )image->res_unit != 2) {
11112     if ((int )image->res_unit != 3) {   11112     if ((int )image->res_unit != 3) {
11113       xres = (float )1.0;   11113       xres = (float )1.0;
11114       yres = (float )1.0;   11114       yres = (float )1.0;
11115     } else {   11115     } else {
11116       goto _L___0;   11116       goto _L___0;
11117     }   11117     }
11118   } else {   11118   } else {
11119     _L___0: /* CIL Label */   11119     _L___0: /* CIL Label */
11120     if (image->xres == (float )0) {   11120     if (image->xres == (float )0) {
11121       goto _L;   11121       goto _L;
11122     } else   11122     } else
11123     if (image->yres == (float )0) {   11123     if (image->yres == (float )0) {
11124       _L: /* CIL Label */   11124       _L: /* CIL Label */
11125       if ((int )crop->crop_mode & 16) {   11125       if ((int )crop->crop_mode & 16) {
11126         TIFFError("computeInputPixelOffsets",   11126         TIFFError("computeInputPixelOffsets",
11127                   "Cannot compute margins or fixed size sections without image resolution");   11127                   "Cannot compute margins or fixed size sections without image resolution");
11128         TIFFError("computeInputPixelOffsets",   11128         TIFFError("computeInputPixelOffsets",
11129                   "Specify units in pixels and try again");   11129                   "Specify units in pixels and try again");
11130         return (-1);   11130         return (-1);
11131       } else   11131       } else
11132       if ((int )crop->crop_mode & 1) {   11132       if ((int )crop->crop_mode & 1) {
11133         TIFFError("computeInputPixelOffsets",   11133         TIFFError("computeInputPixelOffsets",
11134                   "Cannot compute margins or fixed size sections without image resolution");   11134                   "Cannot compute margins or fixed size sections without image resolution");
11135         TIFFError("computeInputPixelOffsets",   11135         TIFFError("computeInputPixelOffsets",
11136                   "Specify units in pixels and try again");   11136                   "Specify units in pixels and try again");
11137         return (-1);   11137         return (-1);
11138       } else   11138       } else
11139       if ((int )crop->crop_mode & 4) {   11139       if ((int )crop->crop_mode & 4) {
11140         TIFFError("computeInputPixelOffsets",   11140         TIFFError("computeInputPixelOffsets",
11141                   "Cannot compute margins or fixed size sections without image resolution");   11141                   "Cannot compute margins or fixed size sections without image resolution");
11142         TIFFError("computeInputPixelOffsets",   11142         TIFFError("computeInputPixelOffsets",
11143                   "Specify units in pixels and try again");   11143                   "Specify units in pixels and try again");
11144         return (-1);   11144         return (-1);
11145       } else   11145       } else
11146       if ((int )crop->crop_mode & 2) {   11146       if ((int )crop->crop_mode & 2) {
11147         TIFFError("computeInputPixelOffsets",   11147         TIFFError("computeInputPixelOffsets",
11148                   "Cannot compute margins or fixed size sections without image resolution");   11148                   "Cannot compute margins or fixed size sections without image resolution");
11149         TIFFError("computeInputPixelOffsets",   11149         TIFFError("computeInputPixelOffsets",
11150                   "Specify units in pixels and try again");   11150                   "Specify units in pixels and try again");
11151         return (-1);   11151         return (-1);
11152       } else {   11152       } else {
11153     11153  
11154       }   11154       }
11155     } else {   11155     } else {
11156     11156  
11157     }   11157     }
11158     xres = image->xres;   11158     xres = image->xres;
11159     yres = image->yres;   11159     yres = image->yres;
11160   }   11160   }
11161   scale = 1.0;   11161   scale = 1.0;
11162   switch ((int )crop->res_unit) {   11162   switch ((int )crop->res_unit) {
11163   case 3:   11163   case 3:
11164   if ((int )image->res_unit == 2) {   11164   if ((int )image->res_unit == 2) {
11165     scale = 1.0 / 2.54;   11165     scale = 1.0 / 2.54;
11166   } else {   11166   } else {
11167     11167  
11168   }   11168   }
11169   break;   11169   break;
11170   case 2:   11170   case 2:
11171   if ((int )image->res_unit == 3) {   11171   if ((int )image->res_unit == 3) {
11172     scale = 2.54;   11172     scale = 2.54;
11173   } else {   11173   } else {
11174     11174  
11175   }   11175   }
11176   break;   11176   break;
11177   default:   11177   default:
11178   case 1:   11178   case 1:
11179   break;   11179   break;
11180   }   11180   }
11181   if ((int )crop->crop_mode & 16) {   11181   if ((int )crop->crop_mode & 16) {
11182     max_length = (uint32 )0;   11182     max_length = (uint32 )0;
11183     max_width = max_length;   11183     max_width = max_length;
11184     i = (uint32 )0;   11184     i = (uint32 )0;
11185     while (i < (uint32 )crop->regions) {   11185     while (i < (uint32 )crop->regions) {
11186       if ((int )crop->res_unit == 2) {   11186       if ((int )crop->res_unit == 2) {
11187         x1 = (uint32 )((crop->corners[i].X1 * scale) * (double )xres);   11187         x1 = (uint32 )((crop->corners[i].X1 * scale) * (double )xres);
11188         x2 = (uint32 )((crop->corners[i].X2 * scale) * (double )xres);   11188         x2 = (uint32 )((crop->corners[i].X2 * scale) * (double )xres);
11189         y1___0 = (uint32 )((crop->corners[i].Y1 * scale) * (double )yres);   11189         y1___0 = (uint32 )((crop->corners[i].Y1 * scale) * (double )yres);
11190         y2 = (uint32 )((crop->corners[i].Y2 * scale) * (double )yres);   11190         y2 = (uint32 )((crop->corners[i].Y2 * scale) * (double )yres);
11191       } else   11191       } else
11192       if ((int )crop->res_unit == 3) {   11192       if ((int )crop->res_unit == 3) {
11193         x1 = (uint32 )((crop->corners[i].X1 * scale) * (double )xres);   11193         x1 = (uint32 )((crop->corners[i].X1 * scale) * (double )xres);
11194         x2 = (uint32 )((crop->corners[i].X2 * scale) * (double )xres);   11194         x2 = (uint32 )((crop->corners[i].X2 * scale) * (double )xres);
11195         y1___0 = (uint32 )((crop->corners[i].Y1 * scale) * (double )yres);   11195         y1___0 = (uint32 )((crop->corners[i].Y1 * scale) * (double )yres);
11196         y2 = (uint32 )((crop->corners[i].Y2 * scale) * (double )yres);   11196         y2 = (uint32 )((crop->corners[i].Y2 * scale) * (double )yres);
11197       } else {   11197       } else {
11198         x1 = (uint32 )crop->corners[i].X1;   11198         x1 = (uint32 )crop->corners[i].X1;
11199         x2 = (uint32 )crop->corners[i].X2;   11199         x2 = (uint32 )crop->corners[i].X2;
11200         y1___0 = (uint32 )crop->corners[i].Y1;   11200         y1___0 = (uint32 )crop->corners[i].Y1;
11201         y2 = (uint32 )crop->corners[i].Y2;   11201         y2 = (uint32 )crop->corners[i].Y2;
11202       }   11202       }
11203       if (x1 < 1U) {   11203       if (x1 < 1U) {
11204         crop->regionlist[i].x1 = (uint32 )0;   11204         crop->regionlist[i].x1 = (uint32 )0;
11205       } else {   11205       } else {
11206         crop->regionlist[i].x1 = x1 - 1U;   11206         crop->regionlist[i].x1 = x1 - 1U;
11207       }   11207       }
11208       if (x2 > image->width - 1U) {   11208       if (x2 > image->width - 1U) {
11209         crop->regionlist[i].x2 = image->width - 1U;   11209         crop->regionlist[i].x2 = image->width - 1U;
11210       } else {   11210       } else {
11211         crop->regionlist[i].x2 = x2 - 1U;   11211         crop->regionlist[i].x2 = x2 - 1U;
11212       }   11212       }
11213       zwidth = (crop->regionlist[i].x2 - crop->regionlist[i].x1) + 1U;   11213       zwidth = (crop->regionlist[i].x2 - crop->regionlist[i].x1) + 1U;
11214       if (y1___0 < 1U) {   11214       if (y1___0 < 1U) {
11215         crop->regionlist[i].y1 = (uint32 )0;   11215         crop->regionlist[i].y1 = (uint32 )0;
11216       } else {   11216       } else {
11217         crop->regionlist[i].y1 = y1___0 - 1U;   11217         crop->regionlist[i].y1 = y1___0 - 1U;
11218       }   11218       }
11219       if (y2 > image->length - 1U) {   11219       if (y2 > image->length - 1U) {
11220         crop->regionlist[i].y2 = image->length - 1U;   11220         crop->regionlist[i].y2 = image->length - 1U;
11221       } else {   11221       } else {
11222         crop->regionlist[i].y2 = y2 - 1U;   11222         crop->regionlist[i].y2 = y2 - 1U;
11223       }   11223       }
11224       zlength = (crop->regionlist[i].y2 - crop->regionlist[i].y1) + 1U;   11224       zlength = (crop->regionlist[i].y2 - crop->regionlist[i].y1) + 1U;
11225       if (zwidth > max_width) {   11225       if (zwidth > max_width) {
11226         max_width = zwidth;   11226         max_width = zwidth;
11227       } else {   11227       } else {
11228     11228  
11229       }   11229       }
11230       if (zlength > max_length) {   11230       if (zlength > max_length) {
11231         max_length = zlength;   11231         max_length = zlength;
11232       } else {   11232       } else {
11233     11233  
11234       }   11234       }
11235       buffsize = (((zwidth * (uint32 )image->bps) * (uint32 )image->spp + 7U) / 8U) * (zlength + 1U);   11235       buffsize = (((zwidth * (uint32 )image->bps) * (uint32 )image->spp + 7U) / 8U) * (zlength + 1U);
11236       crop->regionlist[i].buffsize = buffsize;   11236       crop->regionlist[i].buffsize = buffsize;
11237       crop->bufftotal += buffsize;   11237       crop->bufftotal += buffsize;
11238       if ((int )crop->img_mode == 0) {   11238       if ((int )crop->img_mode == 0) {
11239         switch ((int )crop->edge_ref) {   11239         switch ((int )crop->edge_ref) {
11240         case 4:   11240         case 4:
11241         case 2:   11241         case 2:
11242         crop->combined_length = zlength;   11242         crop->combined_length = zlength;
11243         crop->combined_width += zwidth;   11243         crop->combined_width += zwidth;
11244         break;   11244         break;
11245         default:   11245         default:
11246         case 1:   11246         case 1:
11247         case 3:   11247         case 3:
11248         crop->combined_width = zwidth;   11248         crop->combined_width = zwidth;
11249         crop->combined_length += zlength;   11249         crop->combined_length += zlength;
11250         break;   11250         break;
11251         }   11251         }
11252       } else {   11252       } else {
11253     11253  
11254       }   11254       }
11255       i ++;   11255       i ++;
11256     }   11256     }
11257     return (0);   11257     return (0);
11258   } else {   11258   } else {
11259     11259  
11260   }   11260   }
11261   if ((int )crop->crop_mode & 1) {   11261   if ((int )crop->crop_mode & 1) {
11262     if ((int )crop->res_unit != 2) {   11262     if ((int )crop->res_unit != 2) {
11263       if ((int )crop->res_unit != 3) {   11263       if ((int )crop->res_unit != 3) {
11264         tmargin = (uint32 )crop->margins[0];   11264         tmargin = (uint32 )crop->margins[0];
11265         lmargin = (uint32 )crop->margins[1];   11265         lmargin = (uint32 )crop->margins[1];
11266         bmargin = (uint32 )crop->margins[2];   11266         bmargin = (uint32 )crop->margins[2];
11267         rmargin = (uint32 )crop->margins[3];   11267         rmargin = (uint32 )crop->margins[3];
11268       } else {   11268       } else {
11269         tmargin = (uint32 )((crop->margins[0] * scale) * (double )yres);   11269         tmargin = (uint32 )((crop->margins[0] * scale) * (double )yres);
11270         lmargin = (uint32 )((crop->margins[1] * scale) * (double )xres);   11270         lmargin = (uint32 )((crop->margins[1] * scale) * (double )xres);
11271         bmargin = (uint32 )((crop->margins[2] * scale) * (double )yres);   11271         bmargin = (uint32 )((crop->margins[2] * scale) * (double )yres);
11272         rmargin = (uint32 )((crop->margins[3] * scale) * (double )xres);   11272         rmargin = (uint32 )((crop->margins[3] * scale) * (double )xres);
11273       }   11273       }
11274     } else {   11274     } else {
11275       tmargin = (uint32 )((crop->margins[0] * scale) * (double )yres);   11275       tmargin = (uint32 )((crop->margins[0] * scale) * (double )yres);
11276       lmargin = (uint32 )((crop->margins[1] * scale) * (double )xres);   11276       lmargin = (uint32 )((crop->margins[1] * scale) * (double )xres);
11277       bmargin = (uint32 )((crop->margins[2] * scale) * (double )yres);   11277       bmargin = (uint32 )((crop->margins[2] * scale) * (double )yres);
11278       rmargin = (uint32 )((crop->margins[3] * scale) * (double )xres);   11278       rmargin = (uint32 )((crop->margins[3] * scale) * (double )xres);
11279     }   11279     }
11280     if (lmargin + rmargin > image->width) {   11280     if (lmargin + rmargin > image->width) {
11281       TIFFError("computeInputPixelOffsets",   11281       TIFFError("computeInputPixelOffsets",
11282                 "Combined left and right margins exceed image width");   11282                 "Combined left and right margins exceed image width");
11283       lmargin = (uint32 )0;   11283       lmargin = (uint32 )0;
11284       rmargin = (uint32 )0;   11284       rmargin = (uint32 )0;
11285       return (-1);   11285       return (-1);
11286     } else {   11286     } else {
11287     11287  
11288     }   11288     }
11289     if (tmargin + bmargin > image->length) {   11289     if (tmargin + bmargin > image->length) {
11290       TIFFError("computeInputPixelOffsets",   11290       TIFFError("computeInputPixelOffsets",
11291                 "Combined top and bottom margins exceed image length");   11291                 "Combined top and bottom margins exceed image length");
11292       tmargin = (uint32 )0;   11292       tmargin = (uint32 )0;
11293       bmargin = (uint32 )0;   11293       bmargin = (uint32 )0;
11294       return (-1);   11294       return (-1);
11295     } else {   11295     } else {
11296     11296  
11297     }   11297     }
11298   } else {   11298   } else {
11299     tmargin = (uint32 )0;   11299     tmargin = (uint32 )0;
11300     lmargin = (uint32 )0;   11300     lmargin = (uint32 )0;
11301     bmargin = (uint32 )0;   11301     bmargin = (uint32 )0;
11302     rmargin = (uint32 )0;   11302     rmargin = (uint32 )0;
11303   }   11303   }
11304   if ((int )crop->res_unit != 2) {   11304   if ((int )crop->res_unit != 2) {
11305     if ((int )crop->res_unit != 3) {   11305     if ((int )crop->res_unit != 3) {
11306       if ((int )crop->crop_mode & 2) {   11306       if ((int )crop->crop_mode & 2) {
11307         width = (uint32 )crop->width;   11307         width = (uint32 )crop->width;
11308       } else {   11308       } else {
11309         width = (image->width - lmargin) - rmargin;   11309         width = (image->width - lmargin) - rmargin;
11310       }   11310       }
11311       if ((int )crop->crop_mode & 4) {   11311       if ((int )crop->crop_mode & 4) {
11312         length = (uint32 )crop->length;   11312         length = (uint32 )crop->length;
11313       } else {   11313       } else {
11314         length = (image->length - tmargin) - bmargin;   11314         length = (image->length - tmargin) - bmargin;
11315       }   11315       }
11316     } else {   11316     } else {
11317       goto _L___1;   11317       goto _L___1;
11318     }   11318     }
11319   } else {   11319   } else {
11320     _L___1: /* CIL Label */   11320     _L___1: /* CIL Label */
11321     if ((int )crop->crop_mode & 2) {   11321     if ((int )crop->crop_mode & 2) {
11322       width = (uint32 )((crop->width * scale) * (double )image->xres);   11322       width = (uint32 )((crop->width * scale) * (double )image->xres);
11323     } else {   11323     } else {
11324       width = (image->width - lmargin) - rmargin;   11324       width = (image->width - lmargin) - rmargin;
11325     }   11325     }
11326     if ((int )crop->crop_mode & 4) {   11326     if ((int )crop->crop_mode & 4) {
11327       length = (uint32 )((crop->length * scale) * (double )image->yres);   11327       length = (uint32 )((crop->length * scale) * (double )image->yres);
11328     } else {   11328     } else {
11329       length = (image->length - tmargin) - bmargin;   11329       length = (image->length - tmargin) - bmargin;
11330     }   11330     }
11331   }   11331   }
11332   off->tmargin = tmargin;   11332   off->tmargin = tmargin;
11333   off->bmargin = bmargin;   11333   off->bmargin = bmargin;
11334   off->lmargin = lmargin;   11334   off->lmargin = lmargin;
11335   off->rmargin = rmargin;   11335   off->rmargin = rmargin;
11336   switch ((int )crop->edge_ref) {   11336   switch ((int )crop->edge_ref) {
11337   case 3:   11337   case 3:
11338   startx = lmargin;   11338   startx = lmargin;
11339   if (startx + width >= image->width - rmargin) {   11339   if (startx + width >= image->width - rmargin) {
11340     endx = (image->width - rmargin) - 1U;   11340     endx = (image->width - rmargin) - 1U;
11341   } else {   11341   } else {
11342     endx = (startx + width) - 1U;   11342     endx = (startx + width) - 1U;
11343   }   11343   }
11344   endy = (image->length - bmargin) - 1U;   11344   endy = (image->length - bmargin) - 1U;
11345   if (endy - length <= tmargin) {   11345   if (endy - length <= tmargin) {
11346     starty = tmargin;   11346     starty = tmargin;
11347   } else {   11347   } else {
11348     starty = (endy - length) + 1U;   11348     starty = (endy - length) + 1U;
11349   }   11349   }
11350   break;   11350   break;
11351   case 4:   11351   case 4:
11352   endx = (image->width - rmargin) - 1U;   11352   endx = (image->width - rmargin) - 1U;
11353   if (endx - width <= lmargin) {   11353   if (endx - width <= lmargin) {
11354     startx = lmargin;   11354     startx = lmargin;
11355   } else {   11355   } else {
11356     startx = (endx - width) + 1U;   11356     startx = (endx - width) + 1U;
11357   }   11357   }
11358   starty = tmargin;   11358   starty = tmargin;
11359   if (starty + length >= image->length - bmargin) {   11359   if (starty + length >= image->length - bmargin) {
11360     endy = (image->length - bmargin) - 1U;   11360     endy = (image->length - bmargin) - 1U;
11361   } else {   11361   } else {
11362     endy = (starty + length) - 1U;   11362     endy = (starty + length) - 1U;
11363   }   11363   }
11364   break;   11364   break;
11365   default:   11365   default:
11366   case 2:   11366   case 2:
11367   case 1:   11367   case 1:
11368   startx = lmargin;   11368   startx = lmargin;
11369   if (startx + width >= image->width - rmargin) {   11369   if (startx + width >= image->width - rmargin) {
11370     endx = (image->width - rmargin) - 1U;   11370     endx = (image->width - rmargin) - 1U;
11371   } else {   11371   } else {
11372     endx = (startx + width) - 1U;   11372     endx = (startx + width) - 1U;
11373   }   11373   }
11374   starty = tmargin;   11374   starty = tmargin;
11375   if (starty + length >= image->length - bmargin) {   11375   if (starty + length >= image->length - bmargin) {
11376     endy = (image->length - bmargin) - 1U;   11376     endy = (image->length - bmargin) - 1U;
11377   } else {   11377   } else {
11378     endy = (starty + length) - 1U;   11378     endy = (starty + length) - 1U;
11379   }   11379   }
11380   break;   11380   break;
11381   }   11381   }
11382   off->startx = startx;   11382   off->startx = startx;
11383   off->starty = starty;   11383   off->starty = starty;
11384   off->endx = endx;   11384   off->endx = endx;
11385   off->endy = endy;   11385   off->endy = endy;
11386   crop_width = (endx - startx) + 1U;   11386   crop_width = (endx - startx) + 1U;
11387   crop_length = (endy - starty) + 1U;   11387   crop_length = (endy - starty) + 1U;
11388   if (crop_width <= 0U) {   11388   if (crop_width <= 0U) {
11389     TIFFError("computeInputPixelOffsets",   11389     TIFFError("computeInputPixelOffsets",
11390               "Invalid left/right margins and /or image crop width requested");   11390               "Invalid left/right margins and /or image crop width requested");
11391     return (-1);   11391     return (-1);
11392   } else {   11392   } else {
11393     11393  
11394   }   11394   }
11395   if (crop_width > image->width) {   11395   if (crop_width > image->width) {
11396     crop_width = image->width;   11396     crop_width = image->width;
11397   } else {   11397   } else {
11398     11398  
11399   }   11399   }
11400   if (crop_length <= 0U) {   11400   if (crop_length <= 0U) {
11401     TIFFError("computeInputPixelOffsets",   11401     TIFFError("computeInputPixelOffsets",
11402               "Invalid top/bottom margins and /or image crop length requested");   11402               "Invalid top/bottom margins and /or image crop length requested");
11403     return (-1);   11403     return (-1);
11404   } else {   11404   } else {
11405     11405  
11406   }   11406   }
11407   if (crop_length > image->length) {   11407   if (crop_length > image->length) {
11408     crop_length = image->length;   11408     crop_length = image->length;
11409   } else {   11409   } else {
11410     11410  
11411   }   11411   }
11412   off->crop_width = crop_width;   11412   off->crop_width = crop_width;
11413   off->crop_length = crop_length;   11413   off->crop_length = crop_length;
11414   return (0);   11414   return (0);
11415 }   11415 }
11416 }   11416 }
11417 static int getCropOffsets(struct image_data *image , struct crop_mask *crop ,   11417 static int getCropOffsets(struct image_data *image , struct crop_mask *crop ,
11418                           struct dump_opts *dump )   11418                           struct dump_opts *dump )
11419 {   11419 {
11420   struct offset offsets ;   11420   struct offset offsets ;
11421   int i ;   11421   int i ;
11422   int32 test2 ;   11422   int32 test2 ;
11423   uint32 test ;   11423   uint32 test ;
11424   uint32 seg ;   11424   uint32 seg ;
11425   uint32 total ;   11425   uint32 total ;
11426   uint32 need_buff ;   11426   uint32 need_buff ;
11427   uint32 buffsize ;   11427   uint32 buffsize ;
11428   uint32 zwidth ;   11428   uint32 zwidth ;
11429   uint32 zlength ;   11429   uint32 zlength ;
11430   int tmp ;   11430   int tmp ;
11431     11431  
11432   {   11432   {
11433   need_buff = (uint32 )0;   11433   need_buff = (uint32 )0;
11434   memset((void *)(& offsets), '\000', sizeof(struct offset ));   11434   memset((void *)(& offsets), '\000', sizeof(struct offset ));
11435   crop->bufftotal = (uint32 )0;   11435   crop->bufftotal = (uint32 )0;
11436   crop->combined_width = (uint32 )0;   11436   crop->combined_width = (uint32 )0;
11437   crop->combined_length = (uint32 )0;   11437   crop->combined_length = (uint32 )0;
11438   crop->selections = (uint16 )0;   11438   crop->selections = (uint16 )0;
11439   if ((int )crop->crop_mode & 1) {   11439   if ((int )crop->crop_mode & 1) {
11440     goto _L;   11440     goto _L;
11441   } else   11441   } else
11442   if ((int )crop->crop_mode & 16) {   11442   if ((int )crop->crop_mode & 16) {
11443     goto _L;   11443     goto _L;
11444   } else   11444   } else
11445   if ((int )crop->crop_mode & 4) {   11445   if ((int )crop->crop_mode & 4) {
11446     goto _L;   11446     goto _L;
11447   } else   11447   } else
11448   if ((int )crop->crop_mode & 2) {   11448   if ((int )crop->crop_mode & 2) {
11449     _L: /* CIL Label */   11449     _L: /* CIL Label */
11450     tmp = computeInputPixelOffsets(crop, image, & offsets);   11450     tmp = computeInputPixelOffsets(crop, image, & offsets);
11451     if (tmp) {   11451     if (tmp) {
11452       TIFFError("getCropOffsets", "Unable to compute crop margins");   11452       TIFFError("getCropOffsets", "Unable to compute crop margins");
11453       return (-1);   11453       return (-1);
11454     } else {   11454     } else {
11455     11455  
11456     }   11456     }
11457     need_buff = (uint32 )1;   11457     need_buff = (uint32 )1;
11458     crop->selections = crop->regions;   11458     crop->selections = crop->regions;
11459     if ((int )crop->crop_mode & 16) {   11459     if ((int )crop->crop_mode & 16) {
11460       return (0);   11460       return (0);
11461     } else {   11461     } else {
11462     11462  
11463     }   11463     }
11464   } else {   11464   } else {
11465     offsets.tmargin = (uint32 )0;   11465     offsets.tmargin = (uint32 )0;
11466     offsets.lmargin = (uint32 )0;   11466     offsets.lmargin = (uint32 )0;
11467     offsets.bmargin = (uint32 )0;   11467     offsets.bmargin = (uint32 )0;
11468     offsets.rmargin = (uint32 )0;   11468     offsets.rmargin = (uint32 )0;
11469     offsets.crop_width = image->width;   11469     offsets.crop_width = image->width;
11470     offsets.crop_length = image->length;   11470     offsets.crop_length = image->length;
11471     offsets.startx = (uint32 )0;   11471     offsets.startx = (uint32 )0;
11472     offsets.endx = image->width - 1U;   11472     offsets.endx = image->width - 1U;
11473     offsets.starty = (uint32 )0;   11473     offsets.starty = (uint32 )0;
11474     offsets.endy = image->length - 1U;   11474     offsets.endy = image->length - 1U;
11475     need_buff = (uint32 )0;   11475     need_buff = (uint32 )0;
11476   }   11476   }
11477   if ((unsigned int )dump->outfile != (unsigned int )((void *)0)) {   11477   if ((unsigned int )dump->outfile != (unsigned int )((void *)0)) {
11478     dump_info(dump->outfile, dump->format, (char *)"",   11478     dump_info(dump->outfile, dump->format, (char *)"",
11479               (char *)"Margins: Top: %d  Left: %d  Bottom: %d  Right: %d",   11479               (char *)"Margins: Top: %d  Left: %d  Bottom: %d  Right: %d",
11480               offsets.tmargin, offsets.lmargin, offsets.bmargin, offsets.rmargin);   11480               offsets.tmargin, offsets.lmargin, offsets.bmargin, offsets.rmargin);
11481     dump_info(dump->outfile, dump->format, (char *)"",   11481     dump_info(dump->outfile, dump->format, (char *)"",
11482               (char *)"Crop region within margins: Adjusted Width:  %6d  Length: %6d",   11482               (char *)"Crop region within margins: Adjusted Width:  %6d  Length: %6d",
11483               offsets.crop_width, offsets.crop_length);   11483               offsets.crop_width, offsets.crop_length);
11484   } else {   11484   } else {
11485     11485  
11486   }   11486   }
11487   if (! ((int )crop->crop_mode & 8)) {   11487   if (! ((int )crop->crop_mode & 8)) {
11488     if (need_buff == 0U) {   11488     if (need_buff == 0U) {
11489       crop->selections = (uint16 )0;   11489       crop->selections = (uint16 )0;
11490       crop->combined_width = image->width;   11490       crop->combined_width = image->width;
11491       crop->combined_length = image->length;   11491       crop->combined_length = image->length;
11492       return (0);   11492       return (0);
11493     } else {   11493     } else {
11494       crop->selections = (uint16 )1;   11494       crop->selections = (uint16 )1;
11495       crop->zones = (uint16 )1;   11495       crop->zones = (uint16 )1;
11496       crop->zonelist[0].total = 1;   11496       crop->zonelist[0].total = 1;
11497       crop->zonelist[0].position = 1;   11497       crop->zonelist[0].position = 1;
11498     }   11498     }
11499   } else {   11499   } else {
11500     crop->selections = crop->zones;   11500     crop->selections = crop->zones;
11501   }   11501   }
11502   i = 0;   11502   i = 0;
11503   while (i < (int )crop->zones) {   11503   while (i < (int )crop->zones) {
11504     seg = (uint32 )crop->zonelist[i].position;   11504     seg = (uint32 )crop->zonelist[i].position;
11505     total = (uint32 )crop->zonelist[i].total;   11505     total = (uint32 )crop->zonelist[i].total;
11506     switch ((int )crop->edge_ref) {   11506     switch ((int )crop->edge_ref) {
11507     case 2:   11507     case 2:
11508     zlength = offsets.crop_length;   11508     zlength = offsets.crop_length;
11509     crop->regionlist[i].y1 = offsets.starty;   11509     crop->regionlist[i].y1 = offsets.starty;
11510     crop->regionlist[i].y2 = offsets.endy;   11510     crop->regionlist[i].y2 = offsets.endy;
11511     crop->regionlist[i].x1 = offsets.startx + (uint32 )((((double )offsets.crop_width * 1.0) * (double )(seg - 1U)) / (double )total);   11511     crop->regionlist[i].x1 = offsets.startx + (uint32 )((((double )offsets.crop_width * 1.0) * (double )(seg - 1U)) / (double )total);
11512     test = offsets.startx + (uint32 )((((double )offsets.crop_width * 1.0) * (double )seg) / (double )total);   11512     test = offsets.startx + (uint32 )((((double )offsets.crop_width * 1.0) * (double )seg) / (double )total);
11513     if (test > image->width - 1U) {   11513     if (test > image->width - 1U) {
11514       crop->regionlist[i].x2 = image->width - 1U;   11514       crop->regionlist[i].x2 = image->width - 1U;
11515     } else {   11515     } else {
11516       crop->regionlist[i].x2 = test - 1U;   11516       crop->regionlist[i].x2 = test - 1U;
11517     }   11517     }
11518     zwidth = (crop->regionlist[i].x2 - crop->regionlist[i].x1) + 1U;   11518     zwidth = (crop->regionlist[i].x2 - crop->regionlist[i].x1) + 1U;
11519     crop->combined_length = zlength;   11519     crop->combined_length = zlength;
11520     if ((int )crop->exp_mode == 0) {   11520     if ((int )crop->exp_mode == 0) {
11521       crop->combined_width += zwidth;   11521       crop->combined_width += zwidth;
11522     } else {   11522     } else {
11523       crop->combined_width = zwidth;   11523       crop->combined_width = zwidth;
11524     }   11524     }
11525     break;   11525     break;
11526     case 3:   11526     case 3:
11527     zwidth = offsets.crop_width;   11527     zwidth = offsets.crop_width;
11528     crop->regionlist[i].x1 = offsets.startx;   11528     crop->regionlist[i].x1 = offsets.startx;
11529     crop->regionlist[i].x2 = offsets.endx;   11529     crop->regionlist[i].x2 = offsets.endx;
11530     test2 = (int32 )(offsets.endy - (uint32 )((((double )offsets.crop_length * 1.0) * (double )seg) / (double )total));   11530     test2 = (int32 )(offsets.endy - (uint32 )((((double )offsets.crop_length * 1.0) * (double )seg) / (double )total));
11531     if (test2 < 1) {   11531     if (test2 < 1) {
11532       crop->regionlist[i].y1 = (uint32 )0;   11532       crop->regionlist[i].y1 = (uint32 )0;
11533     } else {   11533     } else {
11534       crop->regionlist[i].y1 = (uint32 )(test2 + 1);   11534       crop->regionlist[i].y1 = (uint32 )(test2 + 1);
11535     }   11535     }
11536     test = offsets.endy - (uint32 )((((double )offsets.crop_length * 1.0) * (double )(seg - 1U)) / (double )total);   11536     test = offsets.endy - (uint32 )((((double )offsets.crop_length * 1.0) * (double )(seg - 1U)) / (double )total);
11537     if (test > image->length - 1U) {   11537     if (test > image->length - 1U) {
11538       crop->regionlist[i].y2 = image->length - 1U;   11538       crop->regionlist[i].y2 = image->length - 1U;
11539     } else {   11539     } else {
11540       crop->regionlist[i].y2 = test;   11540       crop->regionlist[i].y2 = test;
11541     }   11541     }
11542     zlength = (crop->regionlist[i].y2 - crop->regionlist[i].y1) + 1U;   11542     zlength = (crop->regionlist[i].y2 - crop->regionlist[i].y1) + 1U;
11543     if ((int )crop->exp_mode == 0) {   11543     if ((int )crop->exp_mode == 0) {
11544       crop->combined_length += zlength;   11544       crop->combined_length += zlength;
11545     } else {   11545     } else {
11546       crop->combined_length = zlength;   11546       crop->combined_length = zlength;
11547     }   11547     }
11548     crop->combined_width = zwidth;   11548     crop->combined_width = zwidth;
11549     break;   11549     break;
11550     case 4:   11550     case 4:
11551     zlength = offsets.crop_length;   11551     zlength = offsets.crop_length;
11552     crop->regionlist[i].y1 = offsets.starty;   11552     crop->regionlist[i].y1 = offsets.starty;
11553     crop->regionlist[i].y2 = offsets.endy;   11553     crop->regionlist[i].y2 = offsets.endy;
11554     crop->regionlist[i].x1 = offsets.startx + (uint32 )(((double )(offsets.crop_width * (total - seg)) * 1.0) / (double )total);   11554     crop->regionlist[i].x1 = offsets.startx + (uint32 )(((double )(offsets.crop_width * (total - seg)) * 1.0) / (double )total);
11555     test = offsets.startx + (uint32 )(((double )(offsets.crop_width * ((total - seg) + 1U)) * 1.0) / (double )total);   11555     test = offsets.startx + (uint32 )(((double )(offsets.crop_width * ((total - seg) + 1U)) * 1.0) / (double )total);
11556     if (test > image->width - 1U) {   11556     if (test > image->width - 1U) {
11557       crop->regionlist[i].x2 = image->width - 1U;   11557       crop->regionlist[i].x2 = image->width - 1U;
11558     } else {   11558     } else {
11559       crop->regionlist[i].x2 = test - 1U;   11559       crop->regionlist[i].x2 = test - 1U;
11560     }   11560     }
11561     zwidth = (crop->regionlist[i].x2 - crop->regionlist[i].x1) + 1U;   11561     zwidth = (crop->regionlist[i].x2 - crop->regionlist[i].x1) + 1U;
11562     crop->combined_length = zlength;   11562     crop->combined_length = zlength;
11563     if ((int )crop->exp_mode == 0) {   11563     if ((int )crop->exp_mode == 0) {
11564       crop->combined_width += zwidth;   11564       crop->combined_width += zwidth;
11565     } else {   11565     } else {
11566       crop->combined_width = zwidth;   11566       crop->combined_width = zwidth;
11567     }   11567     }
11568     break;   11568     break;
11569     default:   11569     default:
11570     case 1:   11570     case 1:
11571     zwidth = offsets.crop_width;   11571     zwidth = offsets.crop_width;
11572     crop->regionlist[i].x1 = offsets.startx;   11572     crop->regionlist[i].x1 = offsets.startx;
11573     crop->regionlist[i].x2 = offsets.endx;   11573     crop->regionlist[i].x2 = offsets.endx;
11574     crop->regionlist[i].y1 = offsets.starty + (uint32 )((((double )offsets.crop_length * 1.0) * (double )(seg - 1U)) / (double )total);   11574     crop->regionlist[i].y1 = offsets.starty + (uint32 )((((double )offsets.crop_length * 1.0) * (double )(seg - 1U)) / (double )total);
11575     test = offsets.starty + (uint32 )((((double )offsets.crop_length * 1.0) * (double )seg) / (double )total);   11575     test = offsets.starty + (uint32 )((((double )offsets.crop_length * 1.0) * (double )seg) / (double )total);
11576     if (test > image->length - 1U) {   11576     if (test > image->length - 1U) {
11577       crop->regionlist[i].y2 = image->length - 1U;   11577       crop->regionlist[i].y2 = image->length - 1U;
11578     } else {   11578     } else {
11579       crop->regionlist[i].y2 = test - 1U;   11579       crop->regionlist[i].y2 = test - 1U;
11580     }   11580     }
11581     zlength = (crop->regionlist[i].y2 - crop->regionlist[i].y1) + 1U;   11581     zlength = (crop->regionlist[i].y2 - crop->regionlist[i].y1) + 1U;
11582     if ((int )crop->exp_mode == 0) {   11582     if ((int )crop->exp_mode == 0) {
11583       crop->combined_length += zlength;   11583       crop->combined_length += zlength;
11584     } else {   11584     } else {
11585       crop->combined_length = zlength;   11585       crop->combined_length = zlength;
11586     }   11586     }
11587     crop->combined_width = zwidth;   11587     crop->combined_width = zwidth;
11588     break;   11588     break;
11589     }   11589     }
11590     buffsize = (((zwidth * (uint32 )image->bps) * (uint32 )image->spp + 7U) / 8U) * (zlength + 1U);   11590     buffsize = (((zwidth * (uint32 )image->bps) * (uint32 )image->spp + 7U) / 8U) * (zlength + 1U);
11591     crop->regionlist[i].width = zwidth;   11591     crop->regionlist[i].width = zwidth;
11592     crop->regionlist[i].length = zlength;   11592     crop->regionlist[i].length = zlength;
11593     crop->regionlist[i].buffsize = buffsize;   11593     crop->regionlist[i].buffsize = buffsize;
11594     crop->bufftotal += buffsize;   11594     crop->bufftotal += buffsize;
11595     if ((unsigned int )dump->outfile != (unsigned int )((void *)0)) {   11595     if ((unsigned int )dump->outfile != (unsigned int )((void *)0)) {
11596       dump_info(dump->outfile, dump->format, (char *)"",   11596       dump_info(dump->outfile, dump->format, (char *)"",
11597                 (char *)"Zone %d, width: %4d, length: %4d, x1: %4d  x2: %4d  y1: %4d  y2: %4d",   11597                 (char *)"Zone %d, width: %4d, length: %4d, x1: %4d  x2: %4d  y1: %4d  y2: %4d",
11598                 i + 1, zwidth, zlength, crop->regionlist[i].x1,   11598                 i + 1, zwidth, zlength, crop->regionlist[i].x1,
11599                 crop->regionlist[i].x2, crop->regionlist[i].y1,   11599                 crop->regionlist[i].x2, crop->regionlist[i].y1,
11600                 crop->regionlist[i].y2);   11600                 crop->regionlist[i].y2);
11601     } else {   11601     } else {
11602     11602  
11603     }   11603     }
11604     i ++;   11604     i ++;
11605   }   11605   }
11606   return (0);   11606   return (0);
11607 }   11607 }
11608 }   11608 }
11609 static int computeOutputPixelOffsets(struct crop_mask *crop ,   11609 static int computeOutputPixelOffsets(struct crop_mask *crop ,
11610                                      struct image_data *image ,   11610                                      struct image_data *image ,
11611                                      struct pagedef *page ,   11611                                      struct pagedef *page ,
11612                                      struct pageseg *sections ,   11612                                      struct pageseg *sections ,
11613                                      struct dump_opts *dump )   11613                                      struct dump_opts *dump )
11614 {   11614 {
11615   double scale ;   11615   double scale ;
11616   uint32 iwidth ;   11616   uint32 iwidth ;
11617   uint32 ilength ;   11617   uint32 ilength ;
11618   uint32 owidth ;   11618   uint32 owidth ;
11619   uint32 olength ;   11619   uint32 olength ;
11620   uint32 pwidth ;   11620   uint32 pwidth ;
11621   uint32 plength ;   11621   uint32 plength ;
11622   uint32 orows ;   11622   uint32 orows ;
11623   uint32 ocols ;   11623   uint32 ocols ;
11624   uint32 hmargin ;   11624   uint32 hmargin ;
11625   uint32 vmargin ;   11625   uint32 vmargin ;
11626   uint32 x1 ;   11626   uint32 x1 ;
11627   uint32 x2 ;   11627   uint32 x2 ;
11628   uint32 y1___0 ;   11628   uint32 y1___0 ;
11629   uint32 y2 ;   11629   uint32 y2 ;
11630   uint32 line_bytes ;   11630   uint32 line_bytes ;
11631   unsigned int orientation ;   11631   unsigned int orientation ;
11632   uint32 i ;   11632   uint32 i ;
11633   uint32 j ;   11633   uint32 j ;
11634   uint32 k ;   11634   uint32 k ;
11635   uint32 tmp ;   11635   uint32 tmp ;
11636     11636  
11637   {   11637   {
11638   scale = 1.0;   11638   scale = 1.0;
11639   if ((int )page->res_unit == 1) {   11639   if ((int )page->res_unit == 1) {
11640     page->res_unit = image->res_unit;   11640     page->res_unit = image->res_unit;
11641   } else {   11641   } else {
11642     11642  
11643   }   11643   }
11644   switch ((int )image->res_unit) {   11644   switch ((int )image->res_unit) {
11645   case 3:   11645   case 3:
11646   if ((int )page->res_unit == 2) {   11646   if ((int )page->res_unit == 2) {
11647     scale = 1.0 / 2.54;   11647     scale = 1.0 / 2.54;
11648   } else {   11648   } else {
11649     11649  
11650   }   11650   }
11651   break;   11651   break;
11652   case 2:   11652   case 2:
11653   if ((int )page->res_unit == 3) {   11653   if ((int )page->res_unit == 3) {
11654     scale = 2.54;   11654     scale = 2.54;
11655   } else {   11655   } else {
11656     11656  
11657   }   11657   }
11658   break;   11658   break;
11659   default:   11659   default:
11660   case 1:   11660   case 1:
11661   break;   11661   break;
11662   }   11662   }
11663   if (crop->combined_width > 0U) {   11663   if (crop->combined_width > 0U) {
11664     iwidth = crop->combined_width;   11664     iwidth = crop->combined_width;
11665   } else {   11665   } else {
11666     iwidth = image->width;   11666     iwidth = image->width;
11667   }   11667   }
11668   if (crop->combined_length > 0U) {   11668   if (crop->combined_length > 0U) {
11669     ilength = crop->combined_length;   11669     ilength = crop->combined_length;
11670   } else {   11670   } else {
11671     ilength = image->length;   11671     ilength = image->length;
11672   }   11672   }
11673   if (page->hres <= 1.0) {   11673   if (page->hres <= 1.0) {
11674     page->hres = (double )image->xres;   11674     page->hres = (double )image->xres;
11675   } else {   11675   } else {
11676     11676  
11677   }   11677   }
11678   if (page->vres <= 1.0) {   11678   if (page->vres <= 1.0) {
11679     page->vres = (double )image->yres;   11679     page->vres = (double )image->yres;
11680   } else {   11680   } else {
11681     11681  
11682   }   11682   }
11683   if (page->hres < 1.0) {   11683   if (page->hres < 1.0) {
11684     TIFFError("computeOutputPixelOffsets",   11684     TIFFError("computeOutputPixelOffsets",
11685               "Invalid horizontal or vertical resolution specified or read from input image");   11685               "Invalid horizontal or vertical resolution specified or read from input image");
11686     return (1);   11686     return (1);
11687   } else   11687   } else
11688   if (page->vres < 1.0) {   11688   if (page->vres < 1.0) {
11689     TIFFError("computeOutputPixelOffsets",   11689     TIFFError("computeOutputPixelOffsets",
11690               "Invalid horizontal or vertical resolution specified or read from input image");   11690               "Invalid horizontal or vertical resolution specified or read from input image");
11691     return (1);   11691     return (1);
11692   } else {   11692   } else {
11693     11693  
11694   }   11694   }
11695   if (page->width <= (double )0) {   11695   if (page->width <= (double )0) {
11696     pwidth = iwidth;   11696     pwidth = iwidth;
11697   } else {   11697   } else {
11698     pwidth = (uint32 )page->width;   11698     pwidth = (uint32 )page->width;
11699   }   11699   }
11700   if (page->length <= (double )0) {   11700   if (page->length <= (double )0) {
11701     plength = ilength;   11701     plength = ilength;
11702   } else {   11702   } else {
11703     plength = (uint32 )page->length;   11703     plength = (uint32 )page->length;
11704   }   11704   }
11705   if (dump->debug) {   11705   if (dump->debug) {
11706     TIFFError("",   11706     TIFFError("",
11707               "Page size: %s, Vres: %3.2f, Hres: %3.2f, Hmargin: %3.2f, Vmargin: %3.2f\n",   11707               "Page size: %s, Vres: %3.2f, Hres: %3.2f, Hmargin: %3.2f, Vmargin: %3.2f\n",
11708               page->name, page->vres, page->hres, page->hmargin, page->vmargin);   11708               page->name, page->vres, page->hres, page->hmargin, page->vmargin);
11709     TIFFError("", "Res_unit: %d, Scale: %3.2f, Page width: %d, length: %d\n",   11709     TIFFError("", "Res_unit: %d, Scale: %3.2f, Page width: %d, length: %d\n",
11710               (int )page->res_unit, scale, pwidth, plength);   11710               (int )page->res_unit, scale, pwidth, plength);
11711   } else {   11711   } else {
11712     11712  
11713   }   11713   }
11714   if (page->mode & 4U) {   11714   if (page->mode & 4U) {
11715     if ((int )page->res_unit == 2) {   11715     if ((int )page->res_unit == 2) {
11716       hmargin = (uint32 )(((page->hmargin * scale) * page->hres) * (double )(((int )image->bps + 7) / 8));   11716       hmargin = (uint32 )(((page->hmargin * scale) * page->hres) * (double )(((int )image->bps + 7) / 8));
11717       vmargin = (uint32 )(((page->vmargin * scale) * page->vres) * (double )(((int )image->bps + 7) / 8));   11717       vmargin = (uint32 )(((page->vmargin * scale) * page->vres) * (double )(((int )image->bps + 7) / 8));
11718     } else   11718     } else
11719     if ((int )page->res_unit == 3) {   11719     if ((int )page->res_unit == 3) {
11720       hmargin = (uint32 )(((page->hmargin * scale) * page->hres) * (double )(((int )image->bps + 7) / 8));   11720       hmargin = (uint32 )(((page->hmargin * scale) * page->hres) * (double )(((int )image->bps + 7) / 8));
11721       vmargin = (uint32 )(((page->vmargin * scale) * page->vres) * (double )(((int )image->bps + 7) / 8));   11721       vmargin = (uint32 )(((page->vmargin * scale) * page->vres) * (double )(((int )image->bps + 7) / 8));
11722     } else {   11722     } else {
11723       hmargin = (uint32 )((page->hmargin * scale) * (double )(((int )image->bps + 7) / 8));   11723       hmargin = (uint32 )((page->hmargin * scale) * (double )(((int )image->bps + 7) / 8));
11724       vmargin = (uint32 )((page->vmargin * scale) * (double )(((int )image->bps + 7) / 8));   11724       vmargin = (uint32 )((page->vmargin * scale) * (double )(((int )image->bps + 7) / 8));
11725     }   11725     }
11726     if ((double )hmargin * 2.0 > (double )pwidth * page->hres) {   11726     if ((double )hmargin * 2.0 > (double )pwidth * page->hres) {
11727       TIFFError("computeOutputPixelOffsets",   11727       TIFFError("computeOutputPixelOffsets",
11728                 "Combined left and right margins exceed page width");   11728                 "Combined left and right margins exceed page width");
11729       hmargin = (uint32 )0;   11729       hmargin = (uint32 )0;
11730       return (-1);   11730       return (-1);
11731     } else {   11731     } else {
11732     11732  
11733     }   11733     }
11734     if ((double )vmargin * 2.0 > (double )plength * page->vres) {   11734     if ((double )vmargin * 2.0 > (double )plength * page->vres) {
11735       TIFFError("computeOutputPixelOffsets",   11735       TIFFError("computeOutputPixelOffsets",
11736                 "Combined top and bottom margins exceed page length");   11736                 "Combined top and bottom margins exceed page length");
11737       vmargin = (uint32 )0;   11737       vmargin = (uint32 )0;
11738       return (-1);   11738       return (-1);
11739     } else {   11739     } else {
11740     11740  
11741     }   11741     }
11742   } else {   11742   } else {
11743     hmargin = (uint32 )0;   11743     hmargin = (uint32 )0;
11744     vmargin = (uint32 )0;   11744     vmargin = (uint32 )0;
11745   }   11745   }
11746   if (page->mode & 8U) {   11746   if (page->mode & 8U) {
11747     if (page->mode & 4U) {   11747     if (page->mode & 4U) {
11748       TIFFError("computeOutputPixelOffsets",   11748       TIFFError("computeOutputPixelOffsets",
11749                 "Output margins cannot be specified with rows and columns");   11749                 "Output margins cannot be specified with rows and columns");
11750     } else {   11750     } else {
11751     11751  
11752     }   11752     }
11753     owidth = (iwidth + (page->cols - 1U)) / page->cols;   11753     owidth = (iwidth + (page->cols - 1U)) / page->cols;
11754     olength = (ilength + (page->rows - 1U)) / page->rows;   11754     olength = (ilength + (page->rows - 1U)) / page->rows;
11755   } else   11755   } else
11756   if (page->mode & 2U) {   11756   if (page->mode & 2U) {
11757     owidth = (uint32 )((double )pwidth * page->hres - (double )(hmargin * 2U));   11757     owidth = (uint32 )((double )pwidth * page->hres - (double )(hmargin * 2U));
11758     olength = (uint32 )((double )plength * page->vres - (double )(vmargin * 2U));   11758     olength = (uint32 )((double )plength * page->vres - (double )(vmargin * 2U));
11759   } else {   11759   } else {
11760     owidth = (uint32 )((double )iwidth - (double )(hmargin * 2U) * page->hres);   11760     owidth = (uint32 )((double )iwidth - (double )(hmargin * 2U) * page->hres);
11761     olength = (uint32 )((double )ilength - (double )(vmargin * 2U) * page->vres);   11761     olength = (uint32 )((double )ilength - (double )(vmargin * 2U) * page->vres);
11762   }   11762   }
11763   if (owidth > iwidth) {   11763   if (owidth > iwidth) {
11764     owidth = iwidth;   11764     owidth = iwidth;
11765   } else {   11765   } else {
11766     11766  
11767   }   11767   }
11768   if (olength > ilength) {   11768   if (olength > ilength) {
11769     olength = ilength;   11769     olength = ilength;
11770   } else {   11770   } else {
11771     11771  
11772   }   11772   }
11773   switch (page->orient) {   11773   switch (page->orient) {
11774   case 1U:   11774   case 1U:
11775   case 0U:   11775   case 0U:
11776   ocols = (iwidth + (owidth - 1U)) / owidth;   11776   ocols = (iwidth + (owidth - 1U)) / owidth;
11777   orows = (ilength + (olength - 1U)) / olength;   11777   orows = (ilength + (olength - 1U)) / olength;
11778   orientation = 1U;   11778   orientation = 1U;
11779   break;   11779   break;
11780   case 2U:   11780   case 2U:
11781   ocols = (iwidth + (olength - 1U)) / olength;   11781   ocols = (iwidth + (olength - 1U)) / olength;
11782   orows = (ilength + (owidth - 1U)) / owidth;   11782   orows = (ilength + (owidth - 1U)) / owidth;
11783   x1 = olength;   11783   x1 = olength;
11784   olength = owidth;   11784   olength = owidth;
11785   owidth = x1;   11785   owidth = x1;
11786   orientation = 2U;   11786   orientation = 2U;
11787   break;   11787   break;
11788   default:   11788   default:
11789   case 16U:   11789   case 16U:
11790   x1 = (iwidth + (owidth - 1U)) / owidth;   11790   x1 = (iwidth + (owidth - 1U)) / owidth;
11791   x2 = (ilength + (olength - 1U)) / olength;   11791   x2 = (ilength + (olength - 1U)) / olength;
11792   y1___0 = (iwidth + (olength - 1U)) / olength;   11792   y1___0 = (iwidth + (olength - 1U)) / olength;
11793   y2 = (ilength + (owidth - 1U)) / owidth;   11793   y2 = (ilength + (owidth - 1U)) / owidth;
11794   if (x1 * x2 < y1___0 * y2) {   11794   if (x1 * x2 < y1___0 * y2) {
11795     ocols = x1;   11795     ocols = x1;
11796     orows = x2;   11796     orows = x2;
11797     orientation = 1U;   11797     orientation = 1U;
11798   } else {   11798   } else {
11799     ocols = y1___0;   11799     ocols = y1___0;
11800     orows = y2;   11800     orows = y2;
11801     x1 = olength;   11801     x1 = olength;
11802     olength = owidth;   11802     olength = owidth;
11803     owidth = x1;   11803     owidth = x1;
11804     orientation = 2U;   11804     orientation = 2U;
11805   }   11805   }
11806   }   11806   }
11807   if (ocols < 1U) {   11807   if (ocols < 1U) {
11808     ocols = (uint32 )1;   11808     ocols = (uint32 )1;
11809   } else {   11809   } else {
11810     11810  
11811   }   11811   }
11812   if (orows < 1U) {   11812   if (orows < 1U) {
11813     orows = (uint32 )1;   11813     orows = (uint32 )1;
11814   } else {   11814   } else {
11815     11815  
11816   }   11816   }
11817   if (page->rows < 1U) {   11817   if (page->rows < 1U) {
11818     page->rows = orows;   11818     page->rows = orows;
11819   } else {   11819   } else {
11820     11820  
11821   }   11821   }
11822   if (page->cols < 1U) {   11822   if (page->cols < 1U) {
11823     page->cols = ocols;   11823     page->cols = ocols;
11824   } else {   11824   } else {
11825     11825  
11826   }   11826   }
11827   if (owidth * (uint32 )image->bps & 7U) {   11827   if (owidth * (uint32 )image->bps & 7U) {
11828     tmp = (owidth * (uint32 )image->bps >> 3) + 1U;   11828     tmp = (owidth * (uint32 )image->bps >> 3) + 1U;
11829   } else {   11829   } else {
11830     tmp = owidth * (uint32 )image->bps >> 3;   11830     tmp = owidth * (uint32 )image->bps >> 3;
11831   }   11831   }
11832   line_bytes = tmp * (uint32 )image->spp;   11832   line_bytes = tmp * (uint32 )image->spp;
11833   if (page->rows * page->cols > 32U) {   11833   if (page->rows * page->cols > 32U) {
11834     TIFFError("computeOutputPixelOffsets",   11834     TIFFError("computeOutputPixelOffsets",
11835               "Rows and Columns exceed maximum sections\nIncrease resolution or reduce sections");   11835               "Rows and Columns exceed maximum sections\nIncrease resolution or reduce sections");
11836     return (-1);   11836     return (-1);
11837   } else {   11837   } else {
11838     11838  
11839   }   11839   }
11840   k = (uint32 )0;   11840   k = (uint32 )0;
11841   i = (uint32 )0;   11841   i = (uint32 )0;
11842   while (i < orows) {   11842   while (i < orows) {
11843     y1___0 = olength * i;   11843     y1___0 = olength * i;
11844     y2 = olength * (i + 1U) - 1U;   11844     y2 = olength * (i + 1U) - 1U;
11845     if (y2 >= ilength) {   11845     if (y2 >= ilength) {
11846       y2 = ilength - 1U;   11846       y2 = ilength - 1U;
11847     } else {   11847     } else {
11848     11848  
11849     }   11849     }
11850     j = (uint32 )0;   11850     j = (uint32 )0;
11851     while (j < ocols) {   11851     while (j < ocols) {
11852       x1 = owidth * j;   11852       x1 = owidth * j;
11853       x2 = owidth * (j + 1U) - 1U;   11853       x2 = owidth * (j + 1U) - 1U;
11854       if (x2 >= iwidth) {   11854       if (x2 >= iwidth) {
11855         x2 = iwidth - 1U;   11855         x2 = iwidth - 1U;
11856       } else {   11856       } else {
11857     11857  
11858       }   11858       }
11859       (sections + k)->x1 = x1;   11859       (sections + k)->x1 = x1;
11860       (sections + k)->x2 = x2;   11860       (sections + k)->x2 = x2;
11861       (sections + k)->y1 = y1___0;   11861       (sections + k)->y1 = y1___0;
11862       (sections + k)->y2 = y2;   11862       (sections + k)->y2 = y2;
11863       (sections + k)->buffsize = line_bytes * olength;   11863       (sections + k)->buffsize = line_bytes * olength;
11864       (sections + k)->position = (int )(k + 1U);   11864       (sections + k)->position = (int )(k + 1U);
11865       (sections + k)->total = (int )(orows * ocols);   11865       (sections + k)->total = (int )(orows * ocols);
11866       j ++;   11866       j ++;
11867       k ++;   11867       k ++;
11868     }   11868     }
11869     i ++;   11869     i ++;
11870   }   11870   }
11871   return (0);   11871   return (0);
11872 }   11872 }
11873 }   11873 }
11874 static int loadImage(TIFF *in , struct image_data *image ,   11874 static int loadImage(TIFF *in , struct image_data *image ,
11875                      struct dump_opts *dump , unsigned char **read_ptr ) ;   11875                      struct dump_opts *dump , unsigned char **read_ptr ) ;
11876 static uint32 prev_readsize  =    (uint32 )0;   11876 static uint32 prev_readsize  =    (uint32 )0;
11877 static int loadImage(TIFF *in , struct image_data *image ,   11877 static int loadImage(TIFF *in , struct image_data *image ,
11878                      struct dump_opts *dump , unsigned char **read_ptr )   11878                      struct dump_opts *dump , unsigned char **read_ptr )
11879 {   11879 {
11880   uint32 i ;   11880   uint32 i ;
11881   float xres ;   11881   float xres ;
11882   float yres ;   11882   float yres ;
11883   uint16 nstrips ;   11883   uint16 nstrips ;
11884   uint16 ntiles ;   11884   uint16 ntiles ;
11885   uint16 planar ;   11885   uint16 planar ;
11886   uint16 bps ;   11886   uint16 bps ;
11887   uint16 spp ;   11887   uint16 spp ;
11888   uint16 res_unit ;   11888   uint16 res_unit ;
11889   uint16 photometric ;   11889   uint16 photometric ;
11890   uint16 orientation ;   11890   uint16 orientation ;
11891   uint32 width ;   11891   uint32 width ;
11892   uint32 length ;   11892   uint32 length ;
11893   uint32 rowsperstrip___0 ;   11893   uint32 rowsperstrip___0 ;
11894   uint32 stsize ;   11894   uint32 stsize ;
11895   uint32 tlsize ;   11895   uint32 tlsize ;
11896   uint32 buffsize ;   11896   uint32 buffsize ;
11897   uint32 scanlinesize ;   11897   uint32 scanlinesize ;
11898   unsigned char *read_buff ;   11898   unsigned char *read_buff ;
11899   unsigned char *new_buff ;   11899   unsigned char *new_buff ;
11900   int readunit ;   11900   int readunit ;
11901   tmsize_t tmp ;   11901   tmsize_t tmp ;
11902   tmsize_t tmp___0 ;   11902   tmsize_t tmp___0 ;
11903   uint32 tmp___1 ;   11903   uint32 tmp___1 ;
11904   tmsize_t tmp___2 ;   11904   tmsize_t tmp___2 ;
11905   uint32 tmp___3 ;   11905   uint32 tmp___3 ;
11906   int tmp___4 ;   11906   int tmp___4 ;
11907   void *tmp___5 ;   11907   void *tmp___5 ;
11908   void *tmp___6 ;   11908   void *tmp___6 ;
11909   void *tmp___7 ;   11909   void *tmp___7 ;
11910   int tmp___8 ;   11910   int tmp___8 ;
11911   int tmp___9 ;   11911   int tmp___9 ;
11912   int tmp___10 ;   11912   int tmp___10 ;
11913   int tmp___11 ;   11913   int tmp___11 ;
11914     11914  
11915   {   11915   {
11916   xres = (float )0.0;   11916   xres = (float )0.0;
11917   yres = (float )0.0;   11917   yres = (float )0.0;
11918   read_buff = (unsigned char *)((void *)0);   11918   read_buff = (unsigned char *)((void *)0);
11919   new_buff = (unsigned char *)((void *)0);   11919   new_buff = (unsigned char *)((void *)0);
11920   readunit = 0;   11920   readunit = 0;
11921   TIFFGetFieldDefaulted(in, (uint32 )258, & bps);   11921   TIFFGetFieldDefaulted(in, (uint32 )258, & bps);
11922   TIFFGetFieldDefaulted(in, (uint32 )277, & spp);   11922   TIFFGetFieldDefaulted(in, (uint32 )277, & spp);
11923   TIFFGetFieldDefaulted(in, (uint32 )284, & planar);   11923   TIFFGetFieldDefaulted(in, (uint32 )284, & planar);
11924   TIFFGetFieldDefaulted(in, (uint32 )274, & orientation);   11924   TIFFGetFieldDefaulted(in, (uint32 )274, & orientation);
11925   TIFFGetField(in, (uint32 )262, & photometric);   11925   TIFFGetField(in, (uint32 )262, & photometric);
11926   TIFFGetField(in, (uint32 )256, & width);   11926   TIFFGetField(in, (uint32 )256, & width);
11927   TIFFGetField(in, (uint32 )257, & length);   11927   TIFFGetField(in, (uint32 )257, & length);
11928   TIFFGetField(in, (uint32 )282, & xres);   11928   TIFFGetField(in, (uint32 )282, & xres);
11929   TIFFGetField(in, (uint32 )283, & yres);   11929   TIFFGetField(in, (uint32 )283, & yres);
11930   TIFFGetFieldDefaulted(in, (uint32 )296, & res_unit);   11930   TIFFGetFieldDefaulted(in, (uint32 )296, & res_unit);
11931   tmp = TIFFScanlineSize(in);   11931   tmp = TIFFScanlineSize(in);
11932   scanlinesize = (uint32 )tmp;   11932   scanlinesize = (uint32 )tmp;
11933   image->bps = bps;   11933   image->bps = bps;
11934   image->spp = spp;   11934   image->spp = spp;
11935   image->planar = planar;   11935   image->planar = planar;
11936   image->width = width;   11936   image->width = width;
11937   image->length = length;   11937   image->length = length;
11938   image->xres = xres;   11938   image->xres = xres;
11939   image->yres = yres;   11939   image->yres = yres;
11940   image->res_unit = res_unit;   11940   image->res_unit = res_unit;
11941   image->photometric = photometric;   11941   image->photometric = photometric;
11942   image->orientation = orientation;   11942   image->orientation = orientation;
11943   switch ((int )orientation) {   11943   switch ((int )orientation) {
11944   case 1:   11944   case 1:
11945   case 0:   11945   case 0:
11946   image->adjustments = (uint16 )0;   11946   image->adjustments = (uint16 )0;
11947   break;   11947   break;
11948   case 2:   11948   case 2:
11949   image->adjustments = (uint16 )1;   11949   image->adjustments = (uint16 )1;
11950   break;   11950   break;
11951   case 3:   11951   case 3:
11952   image->adjustments = (uint16 )16;   11952   image->adjustments = (uint16 )16;
11953   break;   11953   break;
11954   case 4:   11954   case 4:
11955   image->adjustments = (uint16 )2;   11955   image->adjustments = (uint16 )2;
11956   break;   11956   break;
11957   case 5:   11957   case 5:
11958   image->adjustments = (uint16 )10;   11958   image->adjustments = (uint16 )10;
11959   break;   11959   break;
11960   case 6:   11960   case 6:
11961   image->adjustments = (uint16 )8;   11961   image->adjustments = (uint16 )8;
11962   break;   11962   break;
11963   case 7:   11963   case 7:
11964   image->adjustments = (uint16 )34;   11964   image->adjustments = (uint16 )34;
11965   break;   11965   break;
11966   case 8:   11966   case 8:
11967   image->adjustments = (uint16 )32;   11967   image->adjustments = (uint16 )32;
11968   break;   11968   break;
11969   default:   11969   default:
11970   image->adjustments = (uint16 )0;   11970   image->adjustments = (uint16 )0;
11971   image->orientation = (uint16 )1;   11971   image->orientation = (uint16 )1;
11972   }   11972   }
11973   if ((int )bps == 0) {   11973   if ((int )bps == 0) {
11974     TIFFError("loadImage",   11974     TIFFError("loadImage",
11975               "Invalid samples per pixel (%d) or bits per sample (%d)",   11975               "Invalid samples per pixel (%d) or bits per sample (%d)",
11976               (int )spp, (int )bps);   11976               (int )spp, (int )bps);
11977     return (-1);   11977     return (-1);
11978   } else   11978   } else
11979   if ((int )spp == 0) {   11979   if ((int )spp == 0) {
11980     TIFFError("loadImage",   11980     TIFFError("loadImage",
11981               "Invalid samples per pixel (%d) or bits per sample (%d)",   11981               "Invalid samples per pixel (%d) or bits per sample (%d)",
11982               (int )spp, (int )bps);   11982               (int )spp, (int )bps);
11983     return (-1);   11983     return (-1);
11984   } else {   11984   } else {
11985     11985  
11986   }   11986   }
11987   tmp___4 = TIFFIsTiled(in);   11987   tmp___4 = TIFFIsTiled(in);
11988   if (tmp___4) {   11988   if (tmp___4) {
11989     readunit = 2;   11989     readunit = 2;
11990     tmp___0 = TIFFTileSize(in);   11990     tmp___0 = TIFFTileSize(in);
11991     tlsize = (uint32 )tmp___0;   11991     tlsize = (uint32 )tmp___0;
11992     tmp___1 = TIFFNumberOfTiles(in);   11992     tmp___1 = TIFFNumberOfTiles(in);
11993     ntiles = (uint16 )tmp___1;   11993     ntiles = (uint16 )tmp___1;
11994     buffsize = tlsize * (uint32 )ntiles;   11994     buffsize = tlsize * (uint32 )ntiles;
11995     if ((unsigned int )dump->infile != (unsigned int )((void *)0)) {   11995     if ((unsigned int )dump->infile != (unsigned int )((void *)0)) {
11996       dump_info(dump->infile, dump->format, (char *)"",   11996       dump_info(dump->infile, dump->format, (char *)"",
11997                 (char *)"Tilesize: %u, Number of Tiles: %u, Scanline size: %u",   11997                 (char *)"Tilesize: %u, Number of Tiles: %u, Scanline size: %u",
11998                 tlsize, (int )ntiles, scanlinesize);   11998                 tlsize, (int )ntiles, scanlinesize);
11999     } else {   11999     } else {
12000     12000  
12001     }   12001     }
12002   } else {   12002   } else {
12003     readunit = 1;   12003     readunit = 1;
12004     TIFFGetFieldDefaulted(in, (uint32 )278, & rowsperstrip___0);   12004     TIFFGetFieldDefaulted(in, (uint32 )278, & rowsperstrip___0);
12005     tmp___2 = TIFFStripSize(in);   12005     tmp___2 = TIFFStripSize(in);
12006     stsize = (uint32 )tmp___2;   12006     stsize = (uint32 )tmp___2;
12007     tmp___3 = TIFFNumberOfStrips(in);   12007     tmp___3 = TIFFNumberOfStrips(in);
12008     nstrips = (uint16 )tmp___3;   12008     nstrips = (uint16 )tmp___3;
12009     buffsize = stsize * (uint32 )nstrips;   12009     buffsize = stsize * (uint32 )nstrips;
12010     if ((unsigned int )dump->infile != (unsigned int )((void *)0)) {   12010     if ((unsigned int )dump->infile != (unsigned int )((void *)0)) {
12011       dump_info(dump->infile, dump->format, (char *)"",   12011       dump_info(dump->infile, dump->format, (char *)"",
12012                 (char *)"Stripsize: %u, Number of Strips: %u, Rows per Strip: %u, Scanline size: %u",   12012                 (char *)"Stripsize: %u, Number of Strips: %u, Rows per Strip: %u, Scanline size: %u",
12013                 stsize, (int )nstrips, rowsperstrip___0, scanlinesize);   12013                 stsize, (int )nstrips, rowsperstrip___0, scanlinesize);
12014     } else {   12014     } else {
12015     12015  
12016     }   12016     }
12017   }   12017   }
12018   read_buff = *read_ptr;   12018   read_buff = *read_ptr;
12019   if (! read_buff) {   12019   if (! read_buff) {
12020     tmp___5 = _TIFFmalloc((tmsize_t )buffsize);   12020     tmp___5 = _TIFFmalloc((tmsize_t )buffsize);
12021     read_buff = (unsigned char *)tmp___5;   12021     read_buff = (unsigned char *)tmp___5;
12022   } else   12022   } else
12023   if (prev_readsize < buffsize) {   12023   if (prev_readsize < buffsize) {
12024     tmp___6 = _TIFFrealloc((void *)read_buff, (tmsize_t )buffsize);   12024     tmp___6 = _TIFFrealloc((void *)read_buff, (tmsize_t )buffsize);
12025     new_buff = (unsigned char *)tmp___6;   12025     new_buff = (unsigned char *)tmp___6;
12026     if (! new_buff) {   12026     if (! new_buff) {
12027       free((void *)read_buff);   12027       free((void *)read_buff);
12028       tmp___7 = _TIFFmalloc((tmsize_t )buffsize);   12028       tmp___7 = _TIFFmalloc((tmsize_t )buffsize);
12029       read_buff = (unsigned char *)tmp___7;   12029       read_buff = (unsigned char *)tmp___7;
12030     } else {   12030     } else {
12031       read_buff = new_buff;   12031       read_buff = new_buff;
12032     }   12032     }
12033   } else {   12033   } else {
12034     12034  
12035   }   12035   }
12036   if (! read_buff) {   12036   if (! read_buff) {
12037     TIFFError("loadImage", "Unable to allocate/reallocate read buffer");   12037     TIFFError("loadImage", "Unable to allocate/reallocate read buffer");
12038     return (-1);   12038     return (-1);
12039   } else {   12039   } else {
12040     12040  
12041   }   12041   }
12042   _TIFFmemset((void *)read_buff, '\000', (tmsize_t )buffsize);   12042   _TIFFmemset((void *)read_buff, '\000', (tmsize_t )buffsize);
12043   prev_readsize = buffsize;   12043   prev_readsize = buffsize;
12044   *read_ptr = read_buff;   12044   *read_ptr = read_buff;
12045   switch (readunit) {   12045   switch (readunit) {
12046   case 1:   12046   case 1:
12047   if ((int )planar == 1) {   12047   if ((int )planar == 1) {
12048     tmp___8 = readContigStripsIntoBuffer(in, read_buff, length, width, spp);   12048     tmp___8 = readContigStripsIntoBuffer(in, read_buff, length, width, spp);
12049     if (tmp___8) {   12049     if (tmp___8) {
12050     12050  
12051     } else {   12051     } else {
12052       TIFFError("loadImage", "Unable to read contiguous strips into buffer");   12052       TIFFError("loadImage", "Unable to read contiguous strips into buffer");
12053       return (-1);   12053       return (-1);
12054     }   12054     }
12055   } else {   12055   } else {
12056     tmp___9 = readSeparateStripsIntoBuffer(in, read_buff, length, width, spp,   12056     tmp___9 = readSeparateStripsIntoBuffer(in, read_buff, length, width, spp,
12057                                            dump);   12057                                            dump);
12058     if (tmp___9) {   12058     if (tmp___9) {
12059     12059  
12060     } else {   12060     } else {
12061       TIFFError("loadImage", "Unable to read separate strips into buffer");   12061       TIFFError("loadImage", "Unable to read separate strips into buffer");
12062       return (-1);   12062       return (-1);
12063     }   12063     }
12064   }   12064   }
12065   break;   12065   break;
12066   case 2:   12066   case 2:
12067   if ((int )planar == 1) {   12067   if ((int )planar == 1) {
12068     tmp___10 = readContigTilesIntoBuffer(in, read_buff, length, width, spp);   12068     tmp___10 = readContigTilesIntoBuffer(in, read_buff, length, width, spp);
12069     if (tmp___10) {   12069     if (tmp___10) {
12070     12070  
12071     } else {   12071     } else {
12072       TIFFError("loadImage", "Unable to read contiguous tiles into buffer");   12072       TIFFError("loadImage", "Unable to read contiguous tiles into buffer");
12073       return (-1);   12073       return (-1);
12074     }   12074     }
12075   } else {   12075   } else {
12076     tmp___11 = readSeparateTilesIntoBuffer(in, read_buff, length, width, spp);   12076     tmp___11 = readSeparateTilesIntoBuffer(in, read_buff, length, width, spp);
12077     if (tmp___11) {   12077     if (tmp___11) {
12078     12078  
12079     } else {   12079     } else {
12080       TIFFError("loadImage", "Unable to read separate tiles into buffer");   12080       TIFFError("loadImage", "Unable to read separate tiles into buffer");
12081       return (-1);   12081       return (-1);
12082     }   12082     }
12083   }   12083   }
12084   break;   12084   break;
12085   default:   12085   default:
12086   TIFFError("loadImage", "Unsupported image file format");   12086   TIFFError("loadImage", "Unsupported image file format");
12087   return (-1);   12087   return (-1);
12088   break;   12088   break;
12089   }   12089   }
12090   if ((unsigned int )dump->infile != (unsigned int )((void *)0)) {   12090   if ((unsigned int )dump->infile != (unsigned int )((void *)0)) {
12091     if (dump->level == 2) {   12091     if (dump->level == 2) {
12092       dump_info(dump->infile, dump->format, (char *)"loadImage",   12092       dump_info(dump->infile, dump->format, (char *)"loadImage",
12093                 (char *)"Image width %d, length %d, Raw image data, %4d bytes",   12093                 (char *)"Image width %d, length %d, Raw image data, %4d bytes",
12094                 width, length, buffsize);   12094                 width, length, buffsize);
12095       dump_info(dump->infile, dump->format, (char *)"",   12095       dump_info(dump->infile, dump->format, (char *)"",
12096                 (char *)"Bits per sample %d, Samples per pixel %d", (int )bps,   12096                 (char *)"Bits per sample %d, Samples per pixel %d", (int )bps,
12097                 (int )spp);   12097                 (int )spp);
12098       i = (uint32 )0;   12098       i = (uint32 )0;
12099       while (i < length) {   12099       while (i < length) {
12100         dump_buffer(dump->infile, dump->format, (uint32 )1, scanlinesize, i,   12100         dump_buffer(dump->infile, dump->format, (uint32 )1, scanlinesize, i,
12101                     read_buff + i * scanlinesize);   12101                     read_buff + i * scanlinesize);
12102         i ++;   12102         i ++;
12103       }   12103       }
12104     } else {   12104     } else {
12105     12105  
12106     }   12106     }
12107   } else {   12107   } else {
12108     12108  
12109   }   12109   }
12110   return (0);   12110   return (0);
12111 }   12111 }
12112 }   12112 }
12113 static int correct_orientation(struct image_data *image ,   12113 static int correct_orientation(struct image_data *image ,
12114                                unsigned char **work_buff_ptr )   12114                                unsigned char **work_buff_ptr )
12115 {   12115 {
12116   uint16 mirror ;   12116   uint16 mirror ;
12117   uint16 rotation ;   12117   uint16 rotation ;
12118   unsigned char *work_buff ;   12118   unsigned char *work_buff ;
12119   int tmp ;   12119   int tmp ;
12120   int tmp___0 ;   12120   int tmp___0 ;
12121   int tmp___1 ;   12121   int tmp___1 ;
12122     12122  
12123   {   12123   {
12124   work_buff = *work_buff_ptr;   12124   work_buff = *work_buff_ptr;
12125   if ((unsigned int )image == (unsigned int )((void *)0)) {   12125   if ((unsigned int )image == (unsigned int )((void *)0)) {
12126     TIFFError("correct_orientatin", "Invalid image or buffer pointer");   12126     TIFFError("correct_orientatin", "Invalid image or buffer pointer");
12127     return (-1);   12127     return (-1);
12128   } else   12128   } else
12129   if ((unsigned int )work_buff == (unsigned int )((void *)0)) {   12129   if ((unsigned int )work_buff == (unsigned int )((void *)0)) {
12130     TIFFError("correct_orientatin", "Invalid image or buffer pointer");   12130     TIFFError("correct_orientatin", "Invalid image or buffer pointer");
12131     return (-1);   12131     return (-1);
12132   } else {   12132   } else {
12133     12133  
12134   }   12134   }
12135   if ((int )image->adjustments & 1) {   12135   if ((int )image->adjustments & 1) {
12136     goto _L;   12136     goto _L;
12137   } else   12137   } else
12138   if ((int )image->adjustments & 2) {   12138   if ((int )image->adjustments & 2) {
12139     _L: /* CIL Label */   12139     _L: /* CIL Label */
12140     mirror = (uint16 )((int )image->adjustments & 3);   12140     mirror = (uint16 )((int )image->adjustments & 3);
12141     tmp = mirrorImage(image->spp, image->bps, mirror, image->width,   12141     tmp = mirrorImage(image->spp, image->bps, mirror, image->width,
12142                       image->length, work_buff);   12142                       image->length, work_buff);
12143     if (tmp) {   12143     if (tmp) {
12144       TIFFError("correct_orientation", "Unable to mirror image");   12144       TIFFError("correct_orientation", "Unable to mirror image");
12145       return (-1);   12145       return (-1);
12146     } else {   12146     } else {
12147     12147  
12148     }   12148     }
12149   } else {   12149   } else {
12150     12150  
12151   }   12151   }
12152   if ((int )image->adjustments & 8) {   12152   if ((int )image->adjustments & 8) {
12153     goto _L___0;   12153     goto _L___0;
12154   } else   12154   } else
12155   if (16) {   12155   if (16) {
12156     goto _L___0;   12156     goto _L___0;
12157   } else {   12157   } else {
12158     _L___0: /* CIL Label */   12158     _L___0: /* CIL Label */
12159     if ((int )image->adjustments & 8) {   12159     if ((int )image->adjustments & 8) {
12160       rotation = (uint16 )90;   12160       rotation = (uint16 )90;
12161     } else   12161     } else
12162     if ((int )image->adjustments & 16) {   12162     if ((int )image->adjustments & 16) {
12163       rotation = (uint16 )180;   12163       rotation = (uint16 )180;
12164     } else   12164     } else
12165     if ((int )image->adjustments & 32) {   12165     if ((int )image->adjustments & 32) {
12166       rotation = (uint16 )270;   12166       rotation = (uint16 )270;
12167     } else {   12167     } else {
12168       if ((int )image->adjustments & 8) {   12168       if ((int )image->adjustments & 8) {
12169         tmp___0 = 1;   12169         tmp___0 = 1;
12170       } else {   12170       } else {
12171         tmp___0 = 1;   12171         tmp___0 = 1;
12172       }   12172       }
12173       TIFFError("correct_orientation", "Invalid rotation value: %d", tmp___0);   12173       TIFFError("correct_orientation", "Invalid rotation value: %d", tmp___0);
12174       return (-1);   12174       return (-1);
12175     }   12175     }
12176     tmp___1 = rotateImage(rotation, image, & image->width, & image->length,   12176     tmp___1 = rotateImage(rotation, image, & image->width, & image->length,
12177                           work_buff_ptr);   12177                           work_buff_ptr);
12178     if (tmp___1) {   12178     if (tmp___1) {
12179       TIFFError("correct_orientation", "Unable to rotate image");   12179       TIFFError("correct_orientation", "Unable to rotate image");
12180       return (-1);   12180       return (-1);
12181     } else {   12181     } else {
12182     12182  
12183     }   12183     }
12184     image->orientation = (uint16 )1;   12184     image->orientation = (uint16 )1;
12185   }   12185   }
12186   return (0);   12186   return (0);
12187 }   12187 }
12188 }   12188 }
12189 static int extractCompositeRegions(struct image_data *image ,   12189 static int extractCompositeRegions(struct image_data *image ,
12190                                    struct crop_mask *crop ,   12190                                    struct crop_mask *crop ,
12191                                    unsigned char *read_buff ,   12191                                    unsigned char *read_buff ,
12192                                    unsigned char *crop_buff )   12192                                    unsigned char *crop_buff )
12193 {   12193 {
12194   int shift_width ;   12194   int shift_width ;
12195   int bytes_per_sample ;   12195   int bytes_per_sample ;
12196   int bytes_per_pixel ;   12196   int bytes_per_pixel ;
12197   uint32 i ;   12197   uint32 i ;
12198   uint32 trailing_bits ;   12198   uint32 trailing_bits ;
12199   uint32 prev_trailing_bits ;   12199   uint32 prev_trailing_bits ;
12200   uint32 row ;   12200   uint32 row ;
12201   uint32 first_row ;   12201   uint32 first_row ;
12202   uint32 last_row ;   12202   uint32 last_row ;
12203   uint32 first_col ;   12203   uint32 first_col ;
12204   uint32 last_col ;   12204   uint32 last_col ;
12205   uint32 src_rowsize ;   12205   uint32 src_rowsize ;
12206   uint32 dst_rowsize ;   12206   uint32 dst_rowsize ;
12207   uint32 src_offset ;   12207   uint32 src_offset ;
12208   uint32 dst_offset ;   12208   uint32 dst_offset ;
12209   uint32 crop_width ;   12209   uint32 crop_width ;
12210   uint32 crop_length ;   12210   uint32 crop_length ;
12211   uint32 img_width ;   12211   uint32 img_width ;
12212   uint32 img_length ;   12212   uint32 img_length ;
12213   uint32 prev_length ;   12213   uint32 prev_length ;
12214   uint32 prev_width ;   12214   uint32 prev_width ;
12215   uint32 composite_width ;   12215   uint32 composite_width ;
12216   uint16 bps ;   12216   uint16 bps ;
12217   uint16 spp ;   12217   uint16 spp ;
12218   uint8 *src ;   12218   uint8 *src ;
12219   uint8 *dst ;   12219   uint8 *dst ;
12220   tsample_t count ;   12220   tsample_t count ;
12221   tsample_t sample ;   12221   tsample_t sample ;
12222   int tmp ;   12222   int tmp ;
12223   int tmp___0 ;   12223   int tmp___0 ;
12224   int tmp___1 ;   12224   int tmp___1 ;
12225   int tmp___2 ;   12225   int tmp___2 ;
12226   int tmp___3 ;   12226   int tmp___3 ;
12227   int tmp___4 ;   12227   int tmp___4 ;
12228   int tmp___5 ;   12228   int tmp___5 ;
12229   int tmp___6 ;   12229   int tmp___6 ;
12230   int tmp___7 ;   12230   int tmp___7 ;
12231   int tmp___8 ;   12231   int tmp___8 ;
12232     12232  
12233   {   12233   {
12234   sample = (tsample_t )0;   12234   sample = (tsample_t )0;
12235   img_width = image->width;   12235   img_width = image->width;
12236   img_length = image->length;   12236   img_length = image->length;
12237   bps = image->bps;   12237   bps = image->bps;
12238   spp = image->spp;   12238   spp = image->spp;
12239   count = spp;   12239   count = spp;
12240   bytes_per_sample = ((int )bps + 7) / 8;   12240   bytes_per_sample = ((int )bps + 7) / 8;
12241   bytes_per_pixel = ((int )bps * (int )spp + 7) / 8;   12241   bytes_per_pixel = ((int )bps * (int )spp + 7) / 8;
12242   if ((int )bps % 8 == 0) {   12242   if ((int )bps % 8 == 0) {
12243     shift_width = 0;   12243     shift_width = 0;
12244   } else   12244   } else
12245   if (bytes_per_pixel < bytes_per_sample + 1) {   12245   if (bytes_per_pixel < bytes_per_sample + 1) {
12246     shift_width = bytes_per_pixel;   12246     shift_width = bytes_per_pixel;
12247   } else {   12247   } else {
12248     shift_width = bytes_per_sample + 1;   12248     shift_width = bytes_per_sample + 1;
12249   }   12249   }
12250   src = read_buff;   12250   src = read_buff;
12251   dst = crop_buff;   12251   dst = crop_buff;
12252   prev_length = (uint32 )0;   12252   prev_length = (uint32 )0;
12253   prev_width = prev_length;   12253   prev_width = prev_length;
12254   trailing_bits = (uint32 )0;   12254   trailing_bits = (uint32 )0;
12255   prev_trailing_bits = trailing_bits;   12255   prev_trailing_bits = trailing_bits;
12256   composite_width = crop->combined_width;   12256   composite_width = crop->combined_width;
12257   crop->combined_width = (uint32 )0;   12257   crop->combined_width = (uint32 )0;
12258   crop->combined_length = (uint32 )0;   12258   crop->combined_length = (uint32 )0;
12259   i = (uint32 )0;   12259   i = (uint32 )0;
12260   while (i < (uint32 )crop->selections) {   12260   while (i < (uint32 )crop->selections) {
12261     first_row = crop->regionlist[i].y1;   12261     first_row = crop->regionlist[i].y1;
12262     last_row = crop->regionlist[i].y2;   12262     last_row = crop->regionlist[i].y2;
12263     first_col = crop->regionlist[i].x1;   12263     first_col = crop->regionlist[i].x1;
12264     last_col = crop->regionlist[i].x2;   12264     last_col = crop->regionlist[i].x2;
12265     crop_width = (last_col - first_col) + 1U;   12265     crop_width = (last_col - first_col) + 1U;
12266     crop_length = (last_row - first_row) + 1U;   12266     crop_length = (last_row - first_row) + 1U;
12267     crop->regionlist[i].width = crop_width;   12267     crop->regionlist[i].width = crop_width;
12268     crop->regionlist[i].length = crop_length;   12268     crop->regionlist[i].length = crop_length;
12269     crop->regionlist[i].buffptr = crop_buff;   12269     crop->regionlist[i].buffptr = crop_buff;
12270     src_rowsize = ((img_width * (uint32 )bps) * (uint32 )spp + 7U) / 8U;   12270     src_rowsize = ((img_width * (uint32 )bps) * (uint32 )spp + 7U) / 8U;
12271     dst_rowsize = ((crop_width * (uint32 )bps) * (uint32 )count + 7U) / 8U;   12271     dst_rowsize = ((crop_width * (uint32 )bps) * (uint32 )count + 7U) / 8U;
12272     switch ((int )crop->edge_ref) {   12272     switch ((int )crop->edge_ref) {
12273     case 3:   12273     case 3:
12274     case 1:   12274     case 1:
12275     default:   12275     default:
12276     if (i > 0U) {   12276     if (i > 0U) {
12277       if (crop_width != crop->regionlist[i - 1U].width) {   12277       if (crop_width != crop->regionlist[i - 1U].width) {
12278         TIFFError("extractCompositeRegions",   12278         TIFFError("extractCompositeRegions",
12279                   "Only equal width regions can be combined for -E top or bottom");   12279                   "Only equal width regions can be combined for -E top or bottom");
12280         return (1);   12280         return (1);
12281       } else {   12281       } else {
12282     12282  
12283       }   12283       }
12284     } else {   12284     } else {
12285     12285  
12286     }   12286     }
12287     crop->combined_width = crop_width;   12287     crop->combined_width = crop_width;
12288     crop->combined_length += crop_length;   12288     crop->combined_length += crop_length;
12289     row = first_row;   12289     row = first_row;
12290     while (row <= last_row) {   12290     while (row <= last_row) {
12291       src_offset = row * src_rowsize;   12291       src_offset = row * src_rowsize;
12292       dst_offset = (row - first_row) * dst_rowsize;   12292       dst_offset = (row - first_row) * dst_rowsize;
12293       src = read_buff + src_offset;   12293       src = read_buff + src_offset;
12294       dst = (crop_buff + dst_offset) + prev_length * dst_rowsize;   12294       dst = (crop_buff + dst_offset) + prev_length * dst_rowsize;
12295       switch (shift_width) {   12295       switch (shift_width) {
12296       case 0:   12296       case 0:
12297       tmp = extractContigSamplesBytes(src, dst, img_width, sample, spp, bps,   12297       tmp = extractContigSamplesBytes(src, dst, img_width, sample, spp, bps,
12298                                       count, first_col, last_col + 1U);   12298                                       count, first_col, last_col + 1U);
12299       if (tmp) {   12299       if (tmp) {
12300         TIFFError("extractCompositeRegions", "Unable to extract row %d", row);   12300         TIFFError("extractCompositeRegions", "Unable to extract row %d", row);
12301         return (1);   12301         return (1);
12302       } else {   12302       } else {
12303     12303  
12304       }   12304       }
12305       break;   12305       break;
12306       case 1:   12306       case 1:
12307       tmp___0 = extractContigSamplesShifted8bits(src, dst, img_width, sample,   12307       tmp___0 = extractContigSamplesShifted8bits(src, dst, img_width, sample,
12308                                                  spp, bps, count, first_col,   12308                                                  spp, bps, count, first_col,
12309                                                  last_col + 1U,   12309                                                  last_col + 1U,
12310                                                  (int )prev_trailing_bits);   12310                                                  (int )prev_trailing_bits);
12311       if (tmp___0) {   12311       if (tmp___0) {
12312         TIFFError("extractCompositeRegions", "Unable to extract row %d", row);   12312         TIFFError("extractCompositeRegions", "Unable to extract row %d", row);
12313         return (1);   12313         return (1);
12314       } else {   12314       } else {
12315     12315  
12316       }   12316       }
12317       break;   12317       break;
12318       case 2:   12318       case 2:
12319       tmp___1 = extractContigSamplesShifted16bits(src, dst, img_width, sample,   12319       tmp___1 = extractContigSamplesShifted16bits(src, dst, img_width, sample,
12320                                                   spp, bps, count, first_col,   12320                                                   spp, bps, count, first_col,
12321                                                   last_col + 1U,   12321                                                   last_col + 1U,
12322                                                   (int )prev_trailing_bits);   12322                                                   (int )prev_trailing_bits);
12323       if (tmp___1) {   12323       if (tmp___1) {
12324         TIFFError("extractCompositeRegions", "Unable to extract row %d", row);   12324         TIFFError("extractCompositeRegions", "Unable to extract row %d", row);
12325         return (1);   12325         return (1);
12326       } else {   12326       } else {
12327     12327  
12328       }   12328       }
12329       break;   12329       break;
12330       case 3:   12330       case 3:
12331       tmp___2 = extractContigSamplesShifted24bits(src, dst, img_width, sample,   12331       tmp___2 = extractContigSamplesShifted24bits(src, dst, img_width, sample,
12332                                                   spp, bps, count, first_col,   12332                                                   spp, bps, count, first_col,
12333                                                   last_col + 1U,   12333                                                   last_col + 1U,
12334                                                   (int )prev_trailing_bits);   12334                                                   (int )prev_trailing_bits);
12335       if (tmp___2) {   12335       if (tmp___2) {
12336         TIFFError("extractCompositeRegions", "Unable to extract row %d", row);   12336         TIFFError("extractCompositeRegions", "Unable to extract row %d", row);
12337         return (1);   12337         return (1);
12338       } else {   12338       } else {
12339     12339  
12340       }   12340       }
12341       break;   12341       break;
12342       case 5:   12342       case 5:
12343       case 4:   12343       case 4:
12344       tmp___3 = extractContigSamplesShifted32bits(src, dst, img_width, sample,   12344       tmp___3 = extractContigSamplesShifted32bits(src, dst, img_width, sample,
12345                                                   spp, bps, count, first_col,   12345                                                   spp, bps, count, first_col,
12346                                                   last_col + 1U,   12346                                                   last_col + 1U,
12347                                                   (int )prev_trailing_bits);   12347                                                   (int )prev_trailing_bits);
12348       if (tmp___3) {   12348       if (tmp___3) {
12349         TIFFError("extractCompositeRegions", "Unable to extract row %d", row);   12349         TIFFError("extractCompositeRegions", "Unable to extract row %d", row);
12350         return (1);   12350         return (1);
12351       } else {   12351       } else {
12352     12352  
12353       }   12353       }
12354       break;   12354       break;
12355       default:   12355       default:
12356       TIFFError("extractCompositeRegions", "Unsupported bit depth %d", (int )bps);   12356       TIFFError("extractCompositeRegions", "Unsupported bit depth %d", (int )bps);
12357       return (1);   12357       return (1);
12358       }   12358       }
12359       row ++;   12359       row ++;
12360     }   12360     }
12361     prev_length += crop_length;   12361     prev_length += crop_length;
12362     break;   12362     break;
12363     case 4:   12363     case 4:
12364     case 2:   12364     case 2:
12365     if (i > 0U) {   12365     if (i > 0U) {
12366       if (crop_length != crop->regionlist[i - 1U].length) {   12366       if (crop_length != crop->regionlist[i - 1U].length) {
12367         TIFFError("extractCompositeRegions",   12367         TIFFError("extractCompositeRegions",
12368                   "Only equal length regions can be combined for -E left or right");   12368                   "Only equal length regions can be combined for -E left or right");
12369         return (1);   12369         return (1);
12370       } else {   12370       } else {
12371     12371  
12372       }   12372       }
12373     } else {   12373     } else {
12374     12374  
12375     }   12375     }
12376     crop->combined_width += crop_width;   12376     crop->combined_width += crop_width;
12377     crop->combined_length = crop_length;   12377     crop->combined_length = crop_length;
12378     dst_rowsize = ((composite_width * (uint32 )bps) * (uint32 )count + 7U) / 8U;   12378     dst_rowsize = ((composite_width * (uint32 )bps) * (uint32 )count + 7U) / 8U;
12379     trailing_bits = ((crop_width * (uint32 )bps) * (uint32 )count) % 8U;   12379     trailing_bits = ((crop_width * (uint32 )bps) * (uint32 )count) % 8U;
12380     row = first_row;   12380     row = first_row;
12381     while (row <= last_row) {   12381     while (row <= last_row) {
12382       src_offset = row * src_rowsize;   12382       src_offset = row * src_rowsize;
12383       dst_offset = (row - first_row) * dst_rowsize;   12383       dst_offset = (row - first_row) * dst_rowsize;
12384       src = read_buff + src_offset;   12384       src = read_buff + src_offset;
12385       dst = (crop_buff + dst_offset) + prev_width;   12385       dst = (crop_buff + dst_offset) + prev_width;
12386       switch (shift_width) {   12386       switch (shift_width) {
12387       case 0:   12387       case 0:
12388       tmp___4 = extractContigSamplesBytes(src, dst, img_width, sample, spp, bps,   12388       tmp___4 = extractContigSamplesBytes(src, dst, img_width, sample, spp, bps,
12389                                           count, first_col, last_col + 1U);   12389                                           count, first_col, last_col + 1U);
12390       if (tmp___4) {   12390       if (tmp___4) {
12391         TIFFError("extractCompositeRegions", "Unable to extract row %d", row);   12391         TIFFError("extractCompositeRegions", "Unable to extract row %d", row);
12392         return (1);   12392         return (1);
12393       } else {   12393       } else {
12394     12394  
12395       }   12395       }
12396       break;   12396       break;
12397       case 1:   12397       case 1:
12398       tmp___5 = extractContigSamplesShifted8bits(src, dst, img_width, sample,   12398       tmp___5 = extractContigSamplesShifted8bits(src, dst, img_width, sample,
12399                                                  spp, bps, count, first_col,   12399                                                  spp, bps, count, first_col,
12400                                                  last_col + 1U,   12400                                                  last_col + 1U,
12401                                                  (int )prev_trailing_bits);   12401                                                  (int )prev_trailing_bits);
12402       if (tmp___5) {   12402       if (tmp___5) {
12403         TIFFError("extractCompositeRegions", "Unable to extract row %d", row);   12403         TIFFError("extractCompositeRegions", "Unable to extract row %d", row);
12404         return (1);   12404         return (1);
12405       } else {   12405       } else {
12406     12406  
12407       }   12407       }
12408       break;   12408       break;
12409       case 2:   12409       case 2:
12410       tmp___6 = extractContigSamplesShifted16bits(src, dst, img_width, sample,   12410       tmp___6 = extractContigSamplesShifted16bits(src, dst, img_width, sample,
12411                                                   spp, bps, count, first_col,   12411                                                   spp, bps, count, first_col,
12412                                                   last_col + 1U,   12412                                                   last_col + 1U,
12413                                                   (int )prev_trailing_bits);   12413                                                   (int )prev_trailing_bits);
12414       if (tmp___6) {   12414       if (tmp___6) {
12415         TIFFError("extractCompositeRegions", "Unable to extract row %d", row);   12415         TIFFError("extractCompositeRegions", "Unable to extract row %d", row);
12416         return (1);   12416         return (1);
12417       } else {   12417       } else {
12418     12418  
12419       }   12419       }
12420       break;   12420       break;
12421       case 3:   12421       case 3:
12422       tmp___7 = extractContigSamplesShifted24bits(src, dst, img_width, sample,   12422       tmp___7 = extractContigSamplesShifted24bits(src, dst, img_width, sample,
12423                                                   spp, bps, count, first_col,   12423                                                   spp, bps, count, first_col,
12424                                                   last_col + 1U,   12424                                                   last_col + 1U,
12425                                                   (int )prev_trailing_bits);   12425                                                   (int )prev_trailing_bits);
12426       if (tmp___7) {   12426       if (tmp___7) {
12427         TIFFError("extractCompositeRegions", "Unable to extract row %d", row);   12427         TIFFError("extractCompositeRegions", "Unable to extract row %d", row);
12428         return (1);   12428         return (1);
12429       } else {   12429       } else {
12430     12430  
12431       }   12431       }
12432       break;   12432       break;
12433       case 5:   12433       case 5:
12434       case 4:   12434       case 4:
12435       tmp___8 = extractContigSamplesShifted32bits(src, dst, img_width, sample,   12435       tmp___8 = extractContigSamplesShifted32bits(src, dst, img_width, sample,
12436                                                   spp, bps, count, first_col,   12436                                                   spp, bps, count, first_col,
12437                                                   last_col + 1U,   12437                                                   last_col + 1U,
12438                                                   (int )prev_trailing_bits);   12438                                                   (int )prev_trailing_bits);
12439       if (tmp___8) {   12439       if (tmp___8) {
12440         TIFFError("extractCompositeRegions", "Unable to extract row %d", row);   12440         TIFFError("extractCompositeRegions", "Unable to extract row %d", row);
12441         return (1);   12441         return (1);
12442       } else {   12442       } else {
12443     12443  
12444       }   12444       }
12445       break;   12445       break;
12446       default:   12446       default:
12447       TIFFError("extractCompositeRegions", "Unsupported bit depth %d", (int )bps);   12447       TIFFError("extractCompositeRegions", "Unsupported bit depth %d", (int )bps);
12448       return (1);   12448       return (1);
12449       }   12449       }
12450       row ++;   12450       row ++;
12451     }   12451     }
12452     prev_width += ((crop_width * (uint32 )bps) * (uint32 )count) / 8U;   12452     prev_width += ((crop_width * (uint32 )bps) * (uint32 )count) / 8U;
12453     prev_trailing_bits += trailing_bits;   12453     prev_trailing_bits += trailing_bits;
12454     if (prev_trailing_bits > 7U) {   12454     if (prev_trailing_bits > 7U) {
12455       prev_trailing_bits -= 8U;   12455       prev_trailing_bits -= 8U;
12456     } else {   12456     } else {
12457     12457  
12458     }   12458     }
12459     break;   12459     break;
12460     }   12460     }
12461     i ++;   12461     i ++;
12462   }   12462   }
12463   if (crop->combined_width != composite_width) {   12463   if (crop->combined_width != composite_width) {
12464     TIFFError("combineSeparateRegions",   12464     TIFFError("combineSeparateRegions",
12465               "Combined width does not match composite width");   12465               "Combined width does not match composite width");
12466   } else {   12466   } else {
12467     12467  
12468   }   12468   }
12469   return (0);   12469   return (0);
12470 }   12470 }
12471 }   12471 }
12472 static int extractSeparateRegion(struct image_data *image ,   12472 static int extractSeparateRegion(struct image_data *image ,
12473                                  struct crop_mask *crop ,   12473                                  struct crop_mask *crop ,
12474                                  unsigned char *read_buff ,   12474                                  unsigned char *read_buff ,
12475                                  unsigned char *crop_buff , int region )   12475                                  unsigned char *crop_buff , int region )
12476 {   12476 {
12477   int shift_width ;   12477   int shift_width ;
12478   int prev_trailing_bits ;   12478   int prev_trailing_bits ;
12479   uint32 bytes_per_sample ;   12479   uint32 bytes_per_sample ;
12480   uint32 bytes_per_pixel ;   12480   uint32 bytes_per_pixel ;
12481   uint32 src_rowsize ;   12481   uint32 src_rowsize ;
12482   uint32 dst_rowsize ;   12482   uint32 dst_rowsize ;
12483   uint32 row ;   12483   uint32 row ;
12484   uint32 first_row ;   12484   uint32 first_row ;
12485   uint32 last_row ;   12485   uint32 last_row ;
12486   uint32 first_col ;   12486   uint32 first_col ;
12487   uint32 last_col ;   12487   uint32 last_col ;
12488   uint32 src_offset ;   12488   uint32 src_offset ;
12489   uint32 dst_offset ;   12489   uint32 dst_offset ;
12490   uint32 crop_width ;   12490   uint32 crop_width ;
12491   uint32 crop_length ;   12491   uint32 crop_length ;
12492   uint32 img_width ;   12492   uint32 img_width ;
12493   uint32 img_length ;   12493   uint32 img_length ;
12494   uint16 bps ;   12494   uint16 bps ;
12495   uint16 spp ;   12495   uint16 spp ;
12496   uint8 *src ;   12496   uint8 *src ;
12497   uint8 *dst ;   12497   uint8 *dst ;
12498   tsample_t count ;   12498   tsample_t count ;
12499   tsample_t sample ;   12499   tsample_t sample ;
12500   int tmp ;   12500   int tmp ;
12501   int tmp___0 ;   12501   int tmp___0 ;
12502   int tmp___1 ;   12502   int tmp___1 ;
12503   int tmp___2 ;   12503   int tmp___2 ;
12504   int tmp___3 ;   12504   int tmp___3 ;
12505     12505  
12506   {   12506   {
12507   prev_trailing_bits = 0;   12507   prev_trailing_bits = 0;
12508   sample = (tsample_t )0;   12508   sample = (tsample_t )0;
12509   img_width = image->width;   12509   img_width = image->width;
12510   img_length = image->length;   12510   img_length = image->length;
12511   bps = image->bps;   12511   bps = image->bps;
12512   spp = image->spp;   12512   spp = image->spp;
12513   count = spp;   12513   count = spp;
12514   bytes_per_sample = (uint32 )(((int )bps + 7) / 8);   12514   bytes_per_sample = (uint32 )(((int )bps + 7) / 8);
12515   bytes_per_pixel = (uint32 )(((int )bps * (int )spp + 7) / 8);   12515   bytes_per_pixel = (uint32 )(((int )bps * (int )spp + 7) / 8);
12516   if ((int )bps % 8 == 0) {   12516   if ((int )bps % 8 == 0) {
12517     shift_width = 0;   12517     shift_width = 0;
12518   } else   12518   } else
12519   if (bytes_per_pixel < bytes_per_sample + 1U) {   12519   if (bytes_per_pixel < bytes_per_sample + 1U) {
12520     shift_width = (int )bytes_per_pixel;   12520     shift_width = (int )bytes_per_pixel;
12521   } else {   12521   } else {
12522     shift_width = (int )(bytes_per_sample + 1U);   12522     shift_width = (int )(bytes_per_sample + 1U);
12523   }   12523   }
12524   first_row = crop->regionlist[region].y1;   12524   first_row = crop->regionlist[region].y1;
12525   last_row = crop->regionlist[region].y2;   12525   last_row = crop->regionlist[region].y2;
12526   first_col = crop->regionlist[region].x1;   12526   first_col = crop->regionlist[region].x1;
12527   last_col = crop->regionlist[region].x2;   12527   last_col = crop->regionlist[region].x2;
12528   crop_width = (last_col - first_col) + 1U;   12528   crop_width = (last_col - first_col) + 1U;
12529   crop_length = (last_row - first_row) + 1U;   12529   crop_length = (last_row - first_row) + 1U;
12530   crop->regionlist[region].width = crop_width;   12530   crop->regionlist[region].width = crop_width;
12531   crop->regionlist[region].length = crop_length;   12531   crop->regionlist[region].length = crop_length;
12532   crop->regionlist[region].buffptr = crop_buff;   12532   crop->regionlist[region].buffptr = crop_buff;
12533   src = read_buff;   12533   src = read_buff;
12534   dst = crop_buff;   12534   dst = crop_buff;
12535   src_rowsize = ((img_width * (uint32 )bps) * (uint32 )spp + 7U) / 8U;   12535   src_rowsize = ((img_width * (uint32 )bps) * (uint32 )spp + 7U) / 8U;
12536   dst_rowsize = ((crop_width * (uint32 )bps) * (uint32 )spp + 7U) / 8U;   12536   dst_rowsize = ((crop_width * (uint32 )bps) * (uint32 )spp + 7U) / 8U;
12537   row = first_row;   12537   row = first_row;
12538   while (row <= last_row) {   12538   while (row <= last_row) {
12539     src_offset = row * src_rowsize;   12539     src_offset = row * src_rowsize;
12540     dst_offset = (row - first_row) * dst_rowsize;   12540     dst_offset = (row - first_row) * dst_rowsize;
12541     src = read_buff + src_offset;   12541     src = read_buff + src_offset;
12542     dst = crop_buff + dst_offset;   12542     dst = crop_buff + dst_offset;
12543     switch (shift_width) {   12543     switch (shift_width) {
12544     case 0:   12544     case 0:
12545     tmp = extractContigSamplesBytes(src, dst, img_width, sample, spp, bps,   12545     tmp = extractContigSamplesBytes(src, dst, img_width, sample, spp, bps,
12546                                     count, first_col, last_col + 1U);   12546                                     count, first_col, last_col + 1U);
12547     if (tmp) {   12547     if (tmp) {
12548       TIFFError("extractSeparateRegion", "Unable to extract row %d", row);   12548       TIFFError("extractSeparateRegion", "Unable to extract row %d", row);
12549       return (1);   12549       return (1);
12550     } else {   12550     } else {
12551     12551  
12552     }   12552     }
12553     break;   12553     break;
12554     case 1:   12554     case 1:
12555     tmp___0 = extractContigSamplesShifted8bits(src, dst, img_width, sample, spp,   12555     tmp___0 = extractContigSamplesShifted8bits(src, dst, img_width, sample, spp,
12556                                                bps, count, first_col,   12556                                                bps, count, first_col,
12557                                                last_col + 1U, prev_trailing_bits);   12557                                                last_col + 1U, prev_trailing_bits);
12558     if (tmp___0) {   12558     if (tmp___0) {
12559       TIFFError("extractSeparateRegion", "Unable to extract row %d", row);   12559       TIFFError("extractSeparateRegion", "Unable to extract row %d", row);
12560       return (1);   12560       return (1);
12561     } else {   12561     } else {
12562     12562  
12563     }   12563     }
12564     break;   12564     break;
12565     case 2:   12565     case 2:
12566     tmp___1 = extractContigSamplesShifted16bits(src, dst, img_width, sample,   12566     tmp___1 = extractContigSamplesShifted16bits(src, dst, img_width, sample,
12567                                                 spp, bps, count, first_col,   12567                                                 spp, bps, count, first_col,
12568                                                 last_col + 1U,   12568                                                 last_col + 1U,
12569                                                 prev_trailing_bits);   12569                                                 prev_trailing_bits);
12570     if (tmp___1) {   12570     if (tmp___1) {
12571       TIFFError("extractSeparateRegion", "Unable to extract row %d", row);   12571       TIFFError("extractSeparateRegion", "Unable to extract row %d", row);
12572       return (1);   12572       return (1);
12573     } else {   12573     } else {
12574     12574  
12575     }   12575     }
12576     break;   12576     break;
12577     case 3:   12577     case 3:
12578     tmp___2 = extractContigSamplesShifted24bits(src, dst, img_width, sample,   12578     tmp___2 = extractContigSamplesShifted24bits(src, dst, img_width, sample,
12579                                                 spp, bps, count, first_col,   12579                                                 spp, bps, count, first_col,
12580                                                 last_col + 1U,   12580                                                 last_col + 1U,
12581                                                 prev_trailing_bits);   12581                                                 prev_trailing_bits);
12582     if (tmp___2) {   12582     if (tmp___2) {
12583       TIFFError("extractSeparateRegion", "Unable to extract row %d", row);   12583       TIFFError("extractSeparateRegion", "Unable to extract row %d", row);
12584       return (1);   12584       return (1);
12585     } else {   12585     } else {
12586     12586  
12587     }   12587     }
12588     break;   12588     break;
12589     case 5:   12589     case 5:
12590     case 4:   12590     case 4:
12591     tmp___3 = extractContigSamplesShifted32bits(src, dst, img_width, sample,   12591     tmp___3 = extractContigSamplesShifted32bits(src, dst, img_width, sample,
12592                                                 spp, bps, count, first_col,   12592                                                 spp, bps, count, first_col,
12593                                                 last_col + 1U,   12593                                                 last_col + 1U,
12594                                                 prev_trailing_bits);   12594                                                 prev_trailing_bits);
12595     if (tmp___3) {   12595     if (tmp___3) {
12596       TIFFError("extractSeparateRegion", "Unable to extract row %d", row);   12596       TIFFError("extractSeparateRegion", "Unable to extract row %d", row);
12597       return (1);   12597       return (1);
12598     } else {   12598     } else {
12599     12599  
12600     }   12600     }
12601     break;   12601     break;
12602     default:   12602     default:
12603     TIFFError("extractSeparateRegion", "Unsupported bit depth %d", (int )bps);   12603     TIFFError("extractSeparateRegion", "Unsupported bit depth %d", (int )bps);
12604     return (1);   12604     return (1);
12605     }   12605     }
12606     row ++;   12606     row ++;
12607   }   12607   }
12608   return (0);   12608   return (0);
12609 }   12609 }
12610 }   12610 }
12611 static int extractImageSection(struct image_data *image ,   12611 static int extractImageSection(struct image_data *image ,
12612                                struct pageseg *section ,   12612                                struct pageseg *section ,
12613                                unsigned char *src_buff ,   12613                                unsigned char *src_buff ,
12614                                unsigned char *sect_buff )   12614                                unsigned char *sect_buff )
12615 {   12615 {
12616   unsigned char bytebuff1 ;   12616   unsigned char bytebuff1 ;
12617   unsigned char bytebuff2 ;   12617   unsigned char bytebuff2 ;
12618   unsigned char *src ;   12618   unsigned char *src ;
12619   unsigned char *dst ;   12619   unsigned char *dst ;
12620   uint32 img_width ;   12620   uint32 img_width ;
12621   uint32 img_length ;   12621   uint32 img_length ;
12622   uint32 img_rowsize ;   12622   uint32 img_rowsize ;
12623   uint32 j ;   12623   uint32 j ;
12624   uint32 shift1 ;   12624   uint32 shift1 ;
12625   uint32 shift2 ;   12625   uint32 shift2 ;
12626   uint32 trailing_bits ;   12626   uint32 trailing_bits ;
12627   uint32 row ;   12627   uint32 row ;
12628   uint32 first_row ;   12628   uint32 first_row ;
12629   uint32 last_row ;   12629   uint32 last_row ;
12630   uint32 first_col ;   12630   uint32 first_col ;
12631   uint32 last_col ;   12631   uint32 last_col ;
12632   uint32 src_offset ;   12632   uint32 src_offset ;
12633   uint32 dst_offset ;   12633   uint32 dst_offset ;
12634   uint32 row_offset ;   12634   uint32 row_offset ;
12635   uint32 col_offset ;   12635   uint32 col_offset ;
12636   uint32 offset1 ;   12636   uint32 offset1 ;
12637   uint32 offset2 ;   12637   uint32 offset2 ;
12638   uint32 full_bytes ;   12638   uint32 full_bytes ;
12639   uint32 sect_width ;   12639   uint32 sect_width ;
12640   uint32 sect_length ;   12640   uint32 sect_length ;
12641   uint16 bps ;   12641   uint16 bps ;
12642   uint16 spp ;   12642   uint16 spp ;
12643     12643  
12644   {   12644   {
12645   img_width = image->width;   12645   img_width = image->width;
12646   img_length = image->length;   12646   img_length = image->length;
12647   bps = image->bps;   12647   bps = image->bps;
12648   spp = image->spp;   12648   spp = image->spp;
12649   src = src_buff;   12649   src = src_buff;
12650   dst = sect_buff;   12650   dst = sect_buff;
12651   src_offset = (uint32 )0;   12651   src_offset = (uint32 )0;
12652   dst_offset = (uint32 )0;   12652   dst_offset = (uint32 )0;
12653   first_row = section->y1;   12653   first_row = section->y1;
12654   last_row = section->y2;   12654   last_row = section->y2;
12655   first_col = section->x1;   12655   first_col = section->x1;
12656   last_col = section->x2;   12656   last_col = section->x2;
12657   sect_width = (last_col - first_col) + 1U;   12657   sect_width = (last_col - first_col) + 1U;
12658   sect_length = (last_row - first_row) + 1U;   12658   sect_length = (last_row - first_row) + 1U;
12659   img_rowsize = ((img_width * (uint32 )bps + 7U) / 8U) * (uint32 )spp;   12659   img_rowsize = ((img_width * (uint32 )bps + 7U) / 8U) * (uint32 )spp;
12660   full_bytes = ((sect_width * (uint32 )spp) * (uint32 )bps) / 8U;   12660   full_bytes = ((sect_width * (uint32 )spp) * (uint32 )bps) / 8U;
12661   trailing_bits = (sect_width * (uint32 )bps) % 8U;   12661   trailing_bits = (sect_width * (uint32 )bps) % 8U;
12662   if ((int )bps % 8 == 0) {   12662   if ((int )bps % 8 == 0) {
12663     col_offset = ((first_col * (uint32 )spp) * (uint32 )bps) / 8U;   12663     col_offset = ((first_col * (uint32 )spp) * (uint32 )bps) / 8U;
12664     row = first_row;   12664     row = first_row;
12665     while (row <= last_row) {   12665     while (row <= last_row) {
12666       row_offset = row * img_rowsize;   12666       row_offset = row * img_rowsize;
12667       src_offset = row_offset + col_offset;   12667       src_offset = row_offset + col_offset;
12668       _TIFFmemcpy((void *)(sect_buff + dst_offset),   12668       _TIFFmemcpy((void *)(sect_buff + dst_offset),
12669                   (void const   *)(src_buff + src_offset), (tmsize_t )full_bytes);   12669                   (void const   *)(src_buff + src_offset), (tmsize_t )full_bytes);
12670       dst_offset += full_bytes;   12670       dst_offset += full_bytes;
12671       row ++;   12671       row ++;
12672     }   12672     }
12673   } else {   12673   } else {
12674     shift1 = (unsigned int )spp * ((first_col * (uint32 )bps) % 8U);   12674     shift1 = (unsigned int )spp * ((first_col * (uint32 )bps) % 8U);
12675     shift2 = (unsigned int )spp * ((last_col * (uint32 )bps) % 8U);   12675     shift2 = (unsigned int )spp * ((last_col * (uint32 )bps) % 8U);
12676     row = first_row;   12676     row = first_row;
12677     while (row <= last_row) {   12677     while (row <= last_row) {
12678       row_offset = row * img_rowsize;   12678       row_offset = row * img_rowsize;
12679       offset1 = row_offset + (first_col * (uint32 )bps) / 8U;   12679       offset1 = row_offset + (first_col * (uint32 )bps) / 8U;
12680       offset2 = row_offset + (last_col * (uint32 )bps) / 8U;   12680       offset2 = row_offset + (last_col * (uint32 )bps) / 8U;
12681       bytebuff2 = (unsigned char)0;   12681       bytebuff2 = (unsigned char)0;
12682       bytebuff1 = bytebuff2;   12682       bytebuff1 = bytebuff2;
12683       if (shift1 == 0U) {   12683       if (shift1 == 0U) {
12684         _TIFFmemcpy((void *)(sect_buff + dst_offset),   12684         _TIFFmemcpy((void *)(sect_buff + dst_offset),
12685                     (void const   *)(src_buff + offset1), (tmsize_t )full_bytes);   12685                     (void const   *)(src_buff + offset1), (tmsize_t )full_bytes);
12686         dst_offset += full_bytes;   12686         dst_offset += full_bytes;
12687         if (trailing_bits != 0U) {   12687         if (trailing_bits != 0U) {
12688           bytebuff2 = (unsigned char )((int )*(src_buff + offset2) & (255 << (7U - shift2)));   12688           bytebuff2 = (unsigned char )((int )*(src_buff + offset2) & (255 << (7U - shift2)));
12689           *(sect_buff + dst_offset) = bytebuff2;   12689           *(sect_buff + dst_offset) = bytebuff2;
12690           dst_offset ++;   12690           dst_offset ++;
12691         } else {   12691         } else {
12692     12692  
12693         }   12693         }
12694       } else {   12694       } else {
12695         j = (uint32 )0;   12695         j = (uint32 )0;
12696         while (j <= full_bytes) {   12696         while (j <= full_bytes) {
12697           bytebuff1 = (unsigned char )((int )*(src_buff + (offset1 + j)) & (255 >> shift1));   12697           bytebuff1 = (unsigned char )((int )*(src_buff + (offset1 + j)) & (255 >> shift1));
12698           bytebuff2 = (unsigned char )((int )*(src_buff + ((offset1 + j) + 1U)) & (255 << (7U - shift1)));   12698           bytebuff2 = (unsigned char )((int )*(src_buff + ((offset1 + j) + 1U)) & (255 << (7U - shift1)));
12699           *(sect_buff + (dst_offset + j)) = (unsigned char )(((int )bytebuff1 << shift1) | ((int )bytebuff2 >> (8U - shift1)));   12699           *(sect_buff + (dst_offset + j)) = (unsigned char )(((int )bytebuff1 << shift1) | ((int )bytebuff2 >> (8U - shift1)));
12700           j ++;   12700           j ++;
12701         }   12701         }
12702         dst_offset += full_bytes;   12702         dst_offset += full_bytes;
12703         if (trailing_bits != 0U) {   12703         if (trailing_bits != 0U) {
12704           if (shift2 > shift1) {   12704           if (shift2 > shift1) {
12705             bytebuff1 = (unsigned char )((int )*(src_buff + (offset1 + full_bytes)) & (255 << (7U - shift2)));   12705             bytebuff1 = (unsigned char )((int )*(src_buff + (offset1 + full_bytes)) & (255 << (7U - shift2)));
12706             bytebuff2 = (unsigned char )((int )bytebuff1 & (255 << shift1));   12706             bytebuff2 = (unsigned char )((int )bytebuff1 & (255 << shift1));
12707             *(sect_buff + dst_offset) = bytebuff2;   12707             *(sect_buff + dst_offset) = bytebuff2;
12708           } else   12708           } else
12709           if (shift2 < shift1) {   12709           if (shift2 < shift1) {
12710             bytebuff2 = (unsigned char )(255 << ((shift1 - shift2) - 1U));   12710             bytebuff2 = (unsigned char )(255 << ((shift1 - shift2) - 1U));
12711             *(sect_buff + dst_offset) = (unsigned char )((int )*(sect_buff + dst_offset) & (int )bytebuff2);   12711             *(sect_buff + dst_offset) = (unsigned char )((int )*(sect_buff + dst_offset) & (int )bytebuff2);
12712           } else {   12712           } else {
12713     12713  
12714           }   12714           }
12715         } else {   12715         } else {
12716     12716  
12717         }   12717         }
12718         dst_offset ++;   12718         dst_offset ++;
12719       }   12719       }
12720       row ++;   12720       row ++;
12721     }   12721     }
12722   }   12722   }
12723   return (0);   12723   return (0);
12724 }   12724 }
12725 }   12725 }
12726 static int writeSelections(TIFF *in , TIFF **out , struct crop_mask *crop ,   12726 static int writeSelections(TIFF *in , TIFF **out , struct crop_mask *crop ,
12727                            struct image_data *image , struct dump_opts *dump ,   12727                            struct image_data *image , struct dump_opts *dump ,
12728                            struct buffinfo *seg_buffs , char *mp ,   12728                            struct buffinfo *seg_buffs , char *mp ,
12729                            char *filename , unsigned int *page ,   12729                            char *filename , unsigned int *page ,
12730                            unsigned int total_pages )   12730                            unsigned int total_pages )
12731 {   12731 {
12732   int i ;   12732   int i ;
12733   int page_count ;   12733   int page_count ;
12734   int autoindex ;   12734   int autoindex ;
12735   unsigned char *crop_buff ;   12735   unsigned char *crop_buff ;
12736   int tmp ;   12736   int tmp ;
12737   int tmp___0 ;   12737   int tmp___0 ;
12738   int tmp___1 ;   12738   int tmp___1 ;
12739   int tmp___2 ;   12739   int tmp___2 ;
12740   int tmp___3 ;   12740   int tmp___3 ;
12741   int tmp___4 ;   12741   int tmp___4 ;
12742   int tmp___5 ;   12742   int tmp___5 ;
12743   int tmp___6 ;   12743   int tmp___6 ;
12744   int tmp___7 ;   12744   int tmp___7 ;
12745   int tmp___8 ;   12745   int tmp___8 ;
12746     12746  
12747   {   12747   {
12748   autoindex = 0;   12748   autoindex = 0;
12749   crop_buff = (unsigned char *)((void *)0);   12749   crop_buff = (unsigned char *)((void *)0);
12750   switch ((int )crop->exp_mode) {   12750   switch ((int )crop->exp_mode) {
12751   case 0:   12751   case 0:
12752   autoindex = 0;   12752   autoindex = 0;
12753   crop_buff = (seg_buffs + 0)->buffer;   12753   crop_buff = (seg_buffs + 0)->buffer;
12754   tmp = update_output_file(out, mp, autoindex, filename, page);   12754   tmp = update_output_file(out, mp, autoindex, filename, page);
12755   if (tmp) {   12755   if (tmp) {
12756     return (1);   12756     return (1);
12757   } else {   12757   } else {
12758     12758  
12759   }   12759   }
12760   page_count = (int )total_pages;   12760   page_count = (int )total_pages;
12761   tmp___0 = writeCroppedImage(in, *out, image, dump, crop->combined_width,   12761   tmp___0 = writeCroppedImage(in, *out, image, dump, crop->combined_width,
12762                               crop->combined_length, crop_buff, (int )*page,   12762                               crop->combined_length, crop_buff, (int )*page,
12763                               (int )total_pages);   12763                               (int )total_pages);
12764   if (tmp___0) {   12764   if (tmp___0) {
12765     TIFFError("writeRegions", "Unable to write new image");   12765     TIFFError("writeRegions", "Unable to write new image");
12766     return (-1);   12766     return (-1);
12767   } else {   12767   } else {
12768     12768  
12769   }   12769   }
12770   break;   12770   break;
12771   case 1:   12771   case 1:
12772   autoindex = 0;   12772   autoindex = 0;
12773   tmp___1 = update_output_file(out, mp, autoindex, filename, page);   12773   tmp___1 = update_output_file(out, mp, autoindex, filename, page);
12774   if (tmp___1) {   12774   if (tmp___1) {
12775     return (1);   12775     return (1);
12776   } else {   12776   } else {
12777     12777  
12778   }   12778   }
12779   page_count = (int )((unsigned int )crop->selections * total_pages);   12779   page_count = (int )((unsigned int )crop->selections * total_pages);
12780   i = 0;   12780   i = 0;
12781   while (i < (int )crop->selections) {   12781   while (i < (int )crop->selections) {
12782     crop_buff = (seg_buffs + i)->buffer;   12782     crop_buff = (seg_buffs + i)->buffer;
12783     tmp___2 = writeCroppedImage(in, *out, image, dump,   12783     tmp___2 = writeCroppedImage(in, *out, image, dump,
12784                                 crop->regionlist[i].width,   12784                                 crop->regionlist[i].width,
12785                                 crop->regionlist[i].length, crop_buff,   12785                                 crop->regionlist[i].length, crop_buff,
12786                                 (int )*page, page_count);   12786                                 (int )*page, page_count);
12787     if (tmp___2) {   12787     if (tmp___2) {
12788       TIFFError("writeRegions", "Unable to write new image");   12788       TIFFError("writeRegions", "Unable to write new image");
12789       return (-1);   12789       return (-1);
12790     } else {   12790     } else {
12791     12791  
12792     }   12792     }
12793     i ++;   12793     i ++;
12794   }   12794   }
12795   break;   12795   break;
12796   case 2:   12796   case 2:
12797   autoindex = 1;   12797   autoindex = 1;
12798   tmp___3 = update_output_file(out, mp, autoindex, filename, page);   12798   tmp___3 = update_output_file(out, mp, autoindex, filename, page);
12799   if (tmp___3) {   12799   if (tmp___3) {
12800     return (1);   12800     return (1);
12801   } else {   12801   } else {
12802     12802  
12803   }   12803   }
12804   crop_buff = (seg_buffs + 0)->buffer;   12804   crop_buff = (seg_buffs + 0)->buffer;
12805   tmp___4 = writeCroppedImage(in, *out, image, dump, crop->combined_width,   12805   tmp___4 = writeCroppedImage(in, *out, image, dump, crop->combined_width,
12806                               crop->combined_length, crop_buff, (int )*page,   12806                               crop->combined_length, crop_buff, (int )*page,
12807                               (int )total_pages);   12807                               (int )total_pages);
12808   if (tmp___4) {   12808   if (tmp___4) {
12809     TIFFError("writeRegions", "Unable to write new image");   12809     TIFFError("writeRegions", "Unable to write new image");
12810     return (-1);   12810     return (-1);
12811   } else {   12811   } else {
12812     12812  
12813   }   12813   }
12814   break;   12814   break;
12815   case 3:   12815   case 3:
12816   autoindex = 1;   12816   autoindex = 1;
12817   page_count = (int )crop->selections;   12817   page_count = (int )crop->selections;
12818   tmp___5 = update_output_file(out, mp, autoindex, filename, page);   12818   tmp___5 = update_output_file(out, mp, autoindex, filename, page);
12819   if (tmp___5) {   12819   if (tmp___5) {
12820     return (1);   12820     return (1);
12821   } else {   12821   } else {
12822     12822  
12823   }   12823   }
12824   i = 0;   12824   i = 0;
12825   while (i < (int )crop->selections) {   12825   while (i < (int )crop->selections) {
12826     crop_buff = (seg_buffs + i)->buffer;   12826     crop_buff = (seg_buffs + i)->buffer;
12827     tmp___6 = writeCroppedImage(in, *out, image, dump,   12827     tmp___6 = writeCroppedImage(in, *out, image, dump,
12828                                 crop->regionlist[i].width,   12828                                 crop->regionlist[i].width,
12829                                 crop->regionlist[i].length, crop_buff,   12829                                 crop->regionlist[i].length, crop_buff,
12830                                 (int )*page, page_count);   12830                                 (int )*page, page_count);
12831     if (tmp___6) {   12831     if (tmp___6) {
12832       TIFFError("writeRegions", "Unable to write new image");   12832       TIFFError("writeRegions", "Unable to write new image");
12833       return (-1);   12833       return (-1);
12834     } else {   12834     } else {
12835     12835  
12836     }   12836     }
12837     i ++;   12837     i ++;
12838   }   12838   }
12839   break;   12839   break;
12840   case 4:   12840   case 4:
12841   autoindex = 1;   12841   autoindex = 1;
12842   page_count = 1;   12842   page_count = 1;
12843   i = 0;   12843   i = 0;
12844   while (i < (int )crop->selections) {   12844   while (i < (int )crop->selections) {
12845     tmp___7 = update_output_file(out, mp, autoindex, filename, page);   12845     tmp___7 = update_output_file(out, mp, autoindex, filename, page);
12846     if (tmp___7) {   12846     if (tmp___7) {
12847       return (1);   12847       return (1);
12848     } else {   12848     } else {
12849     12849  
12850     }   12850     }
12851     crop_buff = (seg_buffs + i)->buffer;   12851     crop_buff = (seg_buffs + i)->buffer;
12852     tmp___8 = writeCroppedImage(in, *out, image, dump,   12852     tmp___8 = writeCroppedImage(in, *out, image, dump,
12853                                 crop->regionlist[i].width,   12853                                 crop->regionlist[i].width,
12854                                 crop->regionlist[i].length, crop_buff,   12854                                 crop->regionlist[i].length, crop_buff,
12855                                 (int )*page, page_count);   12855                                 (int )*page, page_count);
12856     if (tmp___8) {   12856     if (tmp___8) {
12857       TIFFError("writeRegions", "Unable to write new image");   12857       TIFFError("writeRegions", "Unable to write new image");
12858       return (-1);   12858       return (-1);
12859     } else {   12859     } else {
12860     12860  
12861     }   12861     }
12862     i ++;   12862     i ++;
12863   }   12863   }
12864   break;   12864   break;
12865   default:   12865   default:
12866   return (1);   12866   return (1);
12867   }   12867   }
12868   return (0);   12868   return (0);
12869 }   12869 }
12870 }   12870 }
12871 static int writeImageSections(TIFF *in , TIFF *out , struct image_data *image ,   12871 static int writeImageSections(TIFF *in , TIFF *out , struct image_data *image ,
12872                               struct pagedef *page , struct pageseg *sections ,   12872                               struct pagedef *page , struct pageseg *sections ,
12873                               struct dump_opts *dump , unsigned char *src_buff ,   12873                               struct dump_opts *dump , unsigned char *src_buff ,
12874                               unsigned char **sect_buff_ptr )   12874                               unsigned char **sect_buff_ptr )
12875 {   12875 {
12876   double hres ;   12876   double hres ;
12877   double vres ;   12877   double vres ;
12878   uint32 i ;   12878   uint32 i ;
12879   uint32 k ;   12879   uint32 k ;
12880   uint32 width ;   12880   uint32 width ;
12881   uint32 length ;   12881   uint32 length ;
12882   uint32 sectsize ;   12882   uint32 sectsize ;
12883   unsigned char *sect_buff ;   12883   unsigned char *sect_buff ;
12884   double tmp ;   12884   double tmp ;
12885   int tmp___0 ;   12885   int tmp___0 ;
12886   int tmp___1 ;   12886   int tmp___1 ;
12887   int tmp___2 ;   12887   int tmp___2 ;
12888     12888  
12889   {   12889   {
12890   sect_buff = *sect_buff_ptr;   12890   sect_buff = *sect_buff_ptr;
12891   hres = page->hres;   12891   hres = page->hres;
12892   vres = page->vres;   12892   vres = page->vres;
12893   k = page->cols * page->rows;   12893   k = page->cols * page->rows;
12894   if (k < 1U) {   12894   if (k < 1U) {
12895     TIFFError("writeImageSections",   12895     TIFFError("writeImageSections",
12896               "%d Rows and Columns exceed maximum sections\nIncrease resolution or reduce sections",   12896               "%d Rows and Columns exceed maximum sections\nIncrease resolution or reduce sections",
12897               k);   12897               k);
12898     return (-1);   12898     return (-1);
12899   } else   12899   } else
12900   if (k > 32U) {   12900   if (k > 32U) {
12901     TIFFError("writeImageSections",   12901     TIFFError("writeImageSections",
12902               "%d Rows and Columns exceed maximum sections\nIncrease resolution or reduce sections",   12902               "%d Rows and Columns exceed maximum sections\nIncrease resolution or reduce sections",
12903               k);   12903               k);
12904     return (-1);   12904     return (-1);
12905   } else {   12905   } else {
12906     12906  
12907   }   12907   }
12908   i = (uint32 )0;   12908   i = (uint32 )0;
12909   while (i < k) {   12909   while (i < k) {
12910     width = ((sections + i)->x2 - (sections + i)->x1) + 1U;   12910     width = ((sections + i)->x2 - (sections + i)->x1) + 1U;
12911     length = ((sections + i)->y2 - (sections + i)->y1) + 1U;   12911     length = ((sections + i)->y2 - (sections + i)->y1) + 1U;
12912     tmp = ceil((double )(width * (uint32 )image->bps + 7U) / (double )8);   12912     tmp = ceil((double )(width * (uint32 )image->bps + 7U) / (double )8);
12913     sectsize = ((uint32 )tmp * (uint32 )image->spp) * length;   12913     sectsize = ((uint32 )tmp * (uint32 )image->spp) * length;
12914     tmp___0 = createImageSection(sectsize, sect_buff_ptr);   12914     tmp___0 = createImageSection(sectsize, sect_buff_ptr);
12915     if (tmp___0) {   12915     if (tmp___0) {
12916       TIFFError("writeImageSections", "Unable to allocate section buffer");   12916       TIFFError("writeImageSections", "Unable to allocate section buffer");
12917       exit(-1);   12917       exit(-1);
12918     } else {   12918     } else {
12919     12919  
12920     }   12920     }
12921     sect_buff = *sect_buff_ptr;   12921     sect_buff = *sect_buff_ptr;
12922     tmp___1 = extractImageSection(image, sections + i, src_buff, sect_buff);   12922     tmp___1 = extractImageSection(image, sections + i, src_buff, sect_buff);
12923     if (tmp___1) {   12923     if (tmp___1) {
12924       TIFFError("writeImageSections", "Unable to extract image sections");   12924       TIFFError("writeImageSections", "Unable to extract image sections");
12925       exit(-1);   12925       exit(-1);
12926     } else {   12926     } else {
12927     12927  
12928     }   12928     }
12929     tmp___2 = writeSingleSection(in, out, image, dump, width, length, hres,   12929     tmp___2 = writeSingleSection(in, out, image, dump, width, length, hres,
12930                                  vres, sect_buff);   12930                                  vres, sect_buff);
12931     if (tmp___2) {   12931     if (tmp___2) {
12932       TIFFError("writeImageSections", "Unable to write image section");   12932       TIFFError("writeImageSections", "Unable to write image section");
12933       exit(-1);   12933       exit(-1);
12934     } else {   12934     } else {
12935     12935  
12936     }   12936     }
12937     i ++;   12937     i ++;
12938   }   12938   }
12939   return (0);   12939   return (0);
12940 }   12940 }
12941 }   12941 }
12942 static int writeSingleSection(TIFF *in , TIFF *out , struct image_data *image ,   12942 static int writeSingleSection(TIFF *in , TIFF *out , struct image_data *image ,
12943                               struct dump_opts *dump , uint32 width ,   12943                               struct dump_opts *dump , uint32 width ,
12944                               uint32 length , double hres , double vres ,   12944                               uint32 length , double hres , double vres ,
12945                               unsigned char *sect_buff )   12945                               unsigned char *sect_buff )
12946 {   12946 {
12947   uint16 bps ;   12947   uint16 bps ;
12948   uint16 spp ;   12948   uint16 spp ;
12949   struct cpTag *p ;   12949   struct cpTag *p ;
12950   int tmp ;   12950   int tmp ;
12951   int tmp___0 ;   12951   int tmp___0 ;
12952   int tmp___1 ;   12952   int tmp___1 ;
12953   uint16 input_compression ;   12953   uint16 input_compression ;
12954   uint16 input_photometric ;   12954   uint16 input_photometric ;
12955   int tmp___2 ;   12955   int tmp___2 ;
12956   int tmp___3 ;   12956   int tmp___3 ;
12957   int tmp___4 ;   12957   int tmp___4 ;
12958   int tmp___5 ;   12958   int tmp___5 ;
12959   int tmp___6 ;   12959   int tmp___6 ;
12960   int tmp___7 ;   12960   int tmp___7 ;
12961   int tmp___8 ;   12961   int tmp___8 ;
12962   uint32 len32 ;   12962   uint32 len32 ;
12963   void **data ;   12963   void **data ;
12964   int tmp___9 ;   12964   int tmp___9 ;
12965   uint16 ninks ;   12965   uint16 ninks ;
12966   char const   *inknames ;   12966   char const   *inknames ;
12967   int inknameslen ;   12967   int inknameslen ;
12968   size_t tmp___10 ;   12968   size_t tmp___10 ;
12969   char const   *cp ;   12969   char const   *cp ;
12970   void *tmp___11 ;   12970   void *tmp___11 ;
12971   char *tmp___12 ;   12971   char *tmp___12 ;
12972   size_t tmp___13 ;   12972   size_t tmp___13 ;
12973   int tmp___14 ;   12973   int tmp___14 ;
12974   int tmp___15 ;   12974   int tmp___15 ;
12975   unsigned short pg0 ;   12975   unsigned short pg0 ;
12976   unsigned short pg1 ;   12976   unsigned short pg1 ;
12977   int tmp___16 ;   12977   int tmp___16 ;
12978   int tmp___17 ;   12978   int tmp___17 ;
12979   int tmp___18 ;   12979   int tmp___18 ;
12980     12980  
12981   {   12981   {
12982   TIFFSetField(out, (uint32 )256, width);   12982   TIFFSetField(out, (uint32 )256, width);
12983   TIFFSetField(out, (uint32 )257, length);   12983   TIFFSetField(out, (uint32 )257, length);
12984   tmp = TIFFGetField(in, (uint32 )258, & bps);   12984   tmp = TIFFGetField(in, (uint32 )258, & bps);
12985   if (tmp) {   12985   if (tmp) {
12986     TIFFSetField(out, (uint32 )258, (int )bps);   12986     TIFFSetField(out, (uint32 )258, (int )bps);
12987   } else {   12987   } else {
12988     12988  
12989   }   12989   }
12990   tmp___0 = TIFFGetField(in, (uint32 )277, & spp);   12990   tmp___0 = TIFFGetField(in, (uint32 )277, & spp);
12991   if (tmp___0) {   12991   if (tmp___0) {
12992     TIFFSetField(out, (uint32 )277, (int )spp);   12992     TIFFSetField(out, (uint32 )277, (int )spp);
12993   } else {   12993   } else {
12994     12994  
12995   }   12995   }
12996   if ((int )compression != 65535) {   12996   if ((int )compression != 65535) {
12997     TIFFSetField(out, (uint32 )259, (int )compression);   12997     TIFFSetField(out, (uint32 )259, (int )compression);
12998   } else {   12998   } else {
12999     tmp___1 = TIFFGetField(in, (uint32 )259, & compression);   12999     tmp___1 = TIFFGetField(in, (uint32 )259, & compression);
13000     if (tmp___1) {   13000     if (tmp___1) {
13001       TIFFSetField(out, (uint32 )259, (int )compression);   13001       TIFFSetField(out, (uint32 )259, (int )compression);
13002     } else {   13002     } else {
13003     13003  
13004     }   13004     }
13005   }   13005   }
13006   if ((int )compression == 7) {   13006   if ((int )compression == 7) {
13007     tmp___2 = TIFFGetField(in, (uint32 )259, & input_compression);   13007     tmp___2 = TIFFGetField(in, (uint32 )259, & input_compression);
13008     if (tmp___2) {   13008     if (tmp___2) {
13009       if ((int )input_compression == 7) {   13009       if ((int )input_compression == 7) {
13010         TIFFSetField(in, (uint32 )65538, 1);   13010         TIFFSetField(in, (uint32 )65538, 1);
13011       } else {   13011       } else {
13012     13012  
13013       }   13013       }
13014     } else {   13014     } else {
13015     13015  
13016     }   13016     }
13017     tmp___3 = TIFFGetField(in, (uint32 )262, & input_photometric);   13017     tmp___3 = TIFFGetField(in, (uint32 )262, & input_photometric);
13018     if (tmp___3) {   13018     if (tmp___3) {
13019       if ((int )input_photometric == 2) { <> 13019       if (in != 0) {
13020         if (jpegcolormode == 1) { = 13020         if (jpegcolormode == 1) {
13021           TIFFSetField(out, (uint32 )262, 6);   13021           TIFFSetField(out, (uint32 )262, 6);
13022         } else {   13022         } else {
13023           TIFFSetField(out, (uint32 )262, 2);   13023           TIFFSetField(out, (uint32 )262, 2);
13024         }   13024         }
13025       } else {   13025       } else {
13026         TIFFSetField(out, (uint32 )262, (int )input_photometric);   13026         TIFFSetField(out, (uint32 )262, (int )input_photometric);
13027       }   13027       }
13028     } else {   13028     } else {
13029     13029  
13030     }   13030     }
13031   } else   13031   } else
13032   if ((int )compression == 34676) {   13032   if ((int )compression == 34676) {
13033     goto _L;   13033     goto _L;
13034   } else   13034   } else
13035   if ((int )compression == 34677) {   13035   if ((int )compression == 34677) {
13036     _L: /* CIL Label */   13036     _L: /* CIL Label */
13037     if ((int )spp == 1) {   13037     if ((int )spp == 1) {
13038       tmp___4 = 32844;   13038       tmp___4 = 32844;
13039     } else {   13039     } else {
13040       tmp___4 = 32845;   13040       tmp___4 = 32845;
13041     }   13041     }
13042     TIFFSetField(out, (uint32 )262, tmp___4);   13042     TIFFSetField(out, (uint32 )262, tmp___4);
13043   } else {   13043   } else {
13044     TIFFSetField(out, (uint32 )262, (int )image->photometric);   13044     TIFFSetField(out, (uint32 )262, (int )image->photometric);
13045   }   13045   }
13046   if ((int )fillorder != 0) {   13046   if ((int )fillorder != 0) {
13047     TIFFSetField(out, (uint32 )266, (int )fillorder);   13047     TIFFSetField(out, (uint32 )266, (int )fillorder);
13048   } else {   13048   } else {
13049     cpTag(in, out, (uint16 )266, (uint16 )1, (TIFFDataType )3);   13049     cpTag(in, out, (uint16 )266, (uint16 )1, (TIFFDataType )3);
13050   }   13050   }
13051   TIFFSetField(out, (uint32 )274, (int )image->orientation);   13051   TIFFSetField(out, (uint32 )274, (int )image->orientation);
13052   if (outtiled == -1) {   13052   if (outtiled == -1) {
13053     outtiled = TIFFIsTiled(in);   13053     outtiled = TIFFIsTiled(in);
13054   } else {   13054   } else {
13055     13055  
13056   }   13056   }
13057   if (outtiled) {   13057   if (outtiled) {
13058     if (tilewidth == 4294967295U) {   13058     if (tilewidth == 4294967295U) {
13059       TIFFGetField(in, (uint32 )322, & tilewidth);   13059       TIFFGetField(in, (uint32 )322, & tilewidth);
13060     } else {   13060     } else {
13061     13061  
13062     }   13062     }
13063     if (tilelength == 4294967295U) {   13063     if (tilelength == 4294967295U) {
13064       TIFFGetField(in, (uint32 )323, & tilelength);   13064       TIFFGetField(in, (uint32 )323, & tilelength);
13065     } else {   13065     } else {
13066     13066  
13067     }   13067     }
13068     if (tilewidth > width) {   13068     if (tilewidth > width) {
13069       tilewidth = width;   13069       tilewidth = width;
13070     } else {   13070     } else {
13071     13071  
13072     }   13072     }
13073     if (tilelength > length) {   13073     if (tilelength > length) {
13074       tilelength = length;   13074       tilelength = length;
13075     } else {   13075     } else {
13076     13076  
13077     }   13077     }
13078     TIFFDefaultTileSize(out, & tilewidth, & tilelength);   13078     TIFFDefaultTileSize(out, & tilewidth, & tilelength);
13079     TIFFSetField(out, (uint32 )322, tilewidth);   13079     TIFFSetField(out, (uint32 )322, tilewidth);
13080     TIFFSetField(out, (uint32 )323, tilelength);   13080     TIFFSetField(out, (uint32 )323, tilelength);
13081   } else {   13081   } else {
13082     if (rowsperstrip == 0U) {   13082     if (rowsperstrip == 0U) {
13083       tmp___5 = TIFFGetField(in, (uint32 )278, & rowsperstrip);   13083       tmp___5 = TIFFGetField(in, (uint32 )278, & rowsperstrip);
13084       if (tmp___5) {   13084       if (tmp___5) {
13085     13085  
13086       } else {   13086       } else {
13087         rowsperstrip = TIFFDefaultStripSize(out, rowsperstrip);   13087         rowsperstrip = TIFFDefaultStripSize(out, rowsperstrip);
13088       }   13088       }
13089       if (rowsperstrip > length) {   13089       if (rowsperstrip > length) {
13090         if (rowsperstrip != 4294967295U) {   13090         if (rowsperstrip != 4294967295U) {
13091           rowsperstrip = length;   13091           rowsperstrip = length;
13092         } else {   13092         } else {
13093     13093  
13094         }   13094         }
13095       } else {   13095       } else {
13096     13096  
13097       }   13097       }
13098     } else   13098     } else
13099     if (rowsperstrip == 4294967295U) {   13099     if (rowsperstrip == 4294967295U) {
13100       rowsperstrip = length;   13100       rowsperstrip = length;
13101     } else {   13101     } else {
13102     13102  
13103     }   13103     }
13104     TIFFSetField(out, (uint32 )278, rowsperstrip);   13104     TIFFSetField(out, (uint32 )278, rowsperstrip);
13105   }   13105   }
13106   if ((int )config != 65535) {   13106   if ((int )config != 65535) {
13107     TIFFSetField(out, (uint32 )284, (int )config);   13107     TIFFSetField(out, (uint32 )284, (int )config);
13108   } else {   13108   } else {
13109     tmp___6 = TIFFGetField(in, (uint32 )284, & config);   13109     tmp___6 = TIFFGetField(in, (uint32 )284, & config);
13110     if (tmp___6) {   13110     if (tmp___6) {
13111       TIFFSetField(out, (uint32 )284, (int )config);   13111       TIFFSetField(out, (uint32 )284, (int )config);
13112     } else {   13112     } else {
13113     13113  
13114     }   13114     }
13115   }   13115   }
13116   if ((int )spp <= 4) {   13116   if ((int )spp <= 4) {
13117     cpTag(in, out, (uint16 )301, (uint16 )4, (TIFFDataType )3);   13117     cpTag(in, out, (uint16 )301, (uint16 )4, (TIFFDataType )3);
13118   } else {   13118   } else {
13119     13119  
13120   }   13120   }
13121   cpTag(in, out, (uint16 )320, (uint16 )4, (TIFFDataType )3);   13121   cpTag(in, out, (uint16 )320, (uint16 )4, (TIFFDataType )3);
13122   switch ((int )compression) {   13122   switch ((int )compression) {
13123   case 7:   13123   case 7:
13124   TIFFSetField(out, (uint32 )65537, quality);   13124   TIFFSetField(out, (uint32 )65537, quality);
13125   TIFFSetField(out, (uint32 )65538, jpegcolormode);   13125   TIFFSetField(out, (uint32 )65538, jpegcolormode);
13126   break;   13126   break;
13127   case 32946:   13127   case 32946:
13128   case 8:   13128   case 8:
13129   case 5:   13129   case 5:
13130   if ((int )predictor != 65535) {   13130   if ((int )predictor != 65535) {
13131     TIFFSetField(out, (uint32 )317, (int )predictor);   13131     TIFFSetField(out, (uint32 )317, (int )predictor);
13132   } else {   13132   } else {
13133     tmp___7 = TIFFGetField(in, (uint32 )317, & predictor);   13133     tmp___7 = TIFFGetField(in, (uint32 )317, & predictor);
13134     if (tmp___7) {   13134     if (tmp___7) {
13135       TIFFSetField(out, (uint32 )317, (int )predictor);   13135       TIFFSetField(out, (uint32 )317, (int )predictor);
13136     } else {   13136     } else {
13137     13137  
13138     }   13138     }
13139   }   13139   }
13140   break;   13140   break;
13141   case 4:   13141   case 4:
13142   case 3:   13142   case 3:
13143   if ((int )compression == 3) {   13143   if ((int )compression == 3) {
13144     if (g3opts != 4294967295U) {   13144     if (g3opts != 4294967295U) {
13145       TIFFSetField(out, (uint32 )292, g3opts);   13145       TIFFSetField(out, (uint32 )292, g3opts);
13146     } else {   13146     } else {
13147       tmp___8 = TIFFGetField(in, (uint32 )292, & g3opts);   13147       tmp___8 = TIFFGetField(in, (uint32 )292, & g3opts);
13148       if (tmp___8) {   13148       if (tmp___8) {
13149         TIFFSetField(out, (uint32 )292, g3opts);   13149         TIFFSetField(out, (uint32 )292, g3opts);
13150       } else {   13150       } else {
13151     13151  
13152       }   13152       }
13153     }   13153     }
13154   } else {   13154   } else {
13155     cpTag(in, out, (uint16 )293, (uint16 )1, (TIFFDataType )4);   13155     cpTag(in, out, (uint16 )293, (uint16 )1, (TIFFDataType )4);
13156   }   13156   }
13157   cpTag(in, out, (uint16 )326, (uint16 )1, (TIFFDataType )4);   13157   cpTag(in, out, (uint16 )326, (uint16 )1, (TIFFDataType )4);
13158   cpTag(in, out, (uint16 )327, (uint16 )1, (TIFFDataType )4);   13158   cpTag(in, out, (uint16 )327, (uint16 )1, (TIFFDataType )4);
13159   cpTag(in, out, (uint16 )328, (uint16 )1, (TIFFDataType )4);   13159   cpTag(in, out, (uint16 )328, (uint16 )1, (TIFFDataType )4);
13160   cpTag(in, out, (uint16 )34908, (uint16 )1, (TIFFDataType )4);   13160   cpTag(in, out, (uint16 )34908, (uint16 )1, (TIFFDataType )4);
13161   cpTag(in, out, (uint16 )34910, (uint16 )1, (TIFFDataType )4);   13161   cpTag(in, out, (uint16 )34910, (uint16 )1, (TIFFDataType )4);
13162   cpTag(in, out, (uint16 )34909, (uint16 )1, (TIFFDataType )2);   13162   cpTag(in, out, (uint16 )34909, (uint16 )1, (TIFFDataType )2);
13163   break;   13163   break;
13164   }   13164   }
13165   tmp___9 = TIFFGetField(in, (uint32 )34675, & len32, & data);   13165   tmp___9 = TIFFGetField(in, (uint32 )34675, & len32, & data);
13166   if (tmp___9) {   13166   if (tmp___9) {
13167     TIFFSetField(out, (uint32 )34675, len32, data);   13167     TIFFSetField(out, (uint32 )34675, len32, data);
13168   } else {   13168   } else {
13169     13169  
13170   }   13170   }
13171   tmp___15 = TIFFGetField(in, (uint32 )334, & ninks);   13171   tmp___15 = TIFFGetField(in, (uint32 )334, & ninks);
13172   if (tmp___15) {   13172   if (tmp___15) {
13173     TIFFSetField(out, (uint32 )334, (int )ninks);   13173     TIFFSetField(out, (uint32 )334, (int )ninks);
13174     tmp___14 = TIFFGetField(in, (uint32 )333, & inknames);   13174     tmp___14 = TIFFGetField(in, (uint32 )333, & inknames);
13175     if (tmp___14) {   13175     if (tmp___14) {
13176       tmp___10 = strlen(inknames);   13176       tmp___10 = strlen(inknames);
13177       inknameslen = (int )(tmp___10 + 1U);   13177       inknameslen = (int )(tmp___10 + 1U);
13178       cp = inknames;   13178       cp = inknames;
13179       while ((int )ninks > 1) {   13179       while ((int )ninks > 1) {
13180         tmp___11 = __rawmemchr((void const   *)cp, '\000');   13180         tmp___11 = __rawmemchr((void const   *)cp, '\000');
13181         cp = (char const   *)((char *)tmp___11);   13181         cp = (char const   *)((char *)tmp___11);
13182         if (cp) {   13182         if (cp) {
13183           cp ++;   13183           cp ++;
13184           tmp___13 = strlen(cp);   13184           tmp___13 = strlen(cp);
13185           inknameslen = (int )((size_t )inknameslen + (tmp___13 + 1U));   13185           inknameslen = (int )((size_t )inknameslen + (tmp___13 + 1U));
13186         } else {   13186         } else {
13187     13187  
13188         }   13188         }
13189         ninks = (uint16 )((int )ninks - 1);   13189         ninks = (uint16 )((int )ninks - 1);
13190       }   13190       }
13191       TIFFSetField(out, (uint32 )333, inknameslen, inknames);   13191       TIFFSetField(out, (uint32 )333, inknameslen, inknames);
13192     } else {   13192     } else {
13193     13193  
13194     }   13194     }
13195   } else {   13195   } else {
13196     13196  
13197   }   13197   }
13198   tmp___17 = TIFFGetField(in, (uint32 )297, & pg0, & pg1);   13198   tmp___17 = TIFFGetField(in, (uint32 )297, & pg0, & pg1);
13199   if (tmp___17) {   13199   if (tmp___17) {
13200     if (pageNum < 0) {   13200     if (pageNum < 0) {
13201       TIFFSetField(out, (uint32 )297, (int )pg0, (int )pg1);   13201       TIFFSetField(out, (uint32 )297, (int )pg0, (int )pg1);
13202     } else {   13202     } else {
13203       tmp___16 = pageNum;   13203       tmp___16 = pageNum;
13204       pageNum ++;   13204       pageNum ++;
13205       TIFFSetField(out, (uint32 )297, tmp___16, 0);   13205       TIFFSetField(out, (uint32 )297, tmp___16, 0);
13206     }   13206     }
13207   } else {   13207   } else {
13208     13208  
13209   }   13209   }
13210   p = tags;   13210   p = tags;
13211   while ((unsigned int )p < (unsigned int )(& tags[sizeof(tags) / sizeof(tags[0])])) {   13211   while ((unsigned int )p < (unsigned int )(& tags[sizeof(tags) / sizeof(tags[0])])) {
13212     cpTag(in, out, p->tag, p->count, p->type);   13212     cpTag(in, out, p->tag, p->count, p->type);
13213     p ++;   13213     p ++;
13214   }   13214   }
13215   TIFFSetField(out, (uint32 )282, (double )((float )hres));   13215   TIFFSetField(out, (uint32 )282, (double )((float )hres));
13216   TIFFSetField(out, (uint32 )283, (double )((float )vres));   13216   TIFFSetField(out, (uint32 )283, (double )((float )vres));
13217   if (outtiled) {   13217   if (outtiled) {
13218     if ((int )config == 1) {   13218     if ((int )config == 1) {
13219       writeBufferToContigTiles(out, sect_buff, length, width, spp);   13219       writeBufferToContigTiles(out, sect_buff, length, width, spp);
13220     } else {   13220     } else {
13221       writeBufferToSeparateTiles(out, sect_buff, length, width, spp, dump);   13221       writeBufferToSeparateTiles(out, sect_buff, length, width, spp, dump);
13222     }   13222     }
13223   } else   13223   } else
13224   if ((int )config == 1) {   13224   if ((int )config == 1) {
13225     writeBufferToContigStrips(out, sect_buff, length, width, spp);   13225     writeBufferToContigStrips(out, sect_buff, length, width, spp);
13226   } else {   13226   } else {
13227     writeBufferToSeparateStrips(out, sect_buff, length, width, spp, dump);   13227     writeBufferToSeparateStrips(out, sect_buff, length, width, spp, dump);
13228   }   13228   }
13229   tmp___18 = TIFFWriteDirectory(out);   13229   tmp___18 = TIFFWriteDirectory(out);
13230   if (tmp___18) {   13230   if (tmp___18) {
13231     13231  
13232   } else {   13232   } else {
13233     TIFFClose(out);   13233     TIFFClose(out);
13234     return (-1);   13234     return (-1);
13235   }   13235   }
13236   return (0);   13236   return (0);
13237 }   13237 }
13238 }   13238 }
13239 static int createImageSection(uint32 sectsize , unsigned char **sect_buff_ptr ) ;   13239 static int createImageSection(uint32 sectsize , unsigned char **sect_buff_ptr ) ;
13240 static uint32 prev_sectsize  =    (uint32 )0;   13240 static uint32 prev_sectsize  =    (uint32 )0;
13241 static int createImageSection(uint32 sectsize , unsigned char **sect_buff_ptr )   13241 static int createImageSection(uint32 sectsize , unsigned char **sect_buff_ptr )
13242 {   13242 {
13243   unsigned char *sect_buff ;   13243   unsigned char *sect_buff ;
13244   unsigned char *new_buff ;   13244   unsigned char *new_buff ;
13245   void *tmp ;   13245   void *tmp ;
13246   void *tmp___0 ;   13246   void *tmp___0 ;
13247   void *tmp___1 ;   13247   void *tmp___1 ;
13248     13248  
13249   {   13249   {
13250   sect_buff = (unsigned char *)((void *)0);   13250   sect_buff = (unsigned char *)((void *)0);
13251   new_buff = (unsigned char *)((void *)0);   13251   new_buff = (unsigned char *)((void *)0);
13252   sect_buff = *sect_buff_ptr;   13252   sect_buff = *sect_buff_ptr;
13253   if (! sect_buff) {   13253   if (! sect_buff) {
13254     tmp = _TIFFmalloc((tmsize_t )sectsize);   13254     tmp = _TIFFmalloc((tmsize_t )sectsize);
13255     sect_buff = (unsigned char *)tmp;   13255     sect_buff = (unsigned char *)tmp;
13256     *sect_buff_ptr = sect_buff;   13256     *sect_buff_ptr = sect_buff;
13257     _TIFFmemset((void *)sect_buff, 0, (tmsize_t )sectsize);   13257     _TIFFmemset((void *)sect_buff, 0, (tmsize_t )sectsize);
13258   } else   13258   } else
13259   if (prev_sectsize < sectsize) {   13259   if (prev_sectsize < sectsize) {
13260     tmp___0 = _TIFFrealloc((void *)sect_buff, (tmsize_t )sectsize);   13260     tmp___0 = _TIFFrealloc((void *)sect_buff, (tmsize_t )sectsize);
13261     new_buff = (unsigned char *)tmp___0;   13261     new_buff = (unsigned char *)tmp___0;
13262     if (! new_buff) {   13262     if (! new_buff) {
13263       free((void *)sect_buff);   13263       free((void *)sect_buff);
13264       tmp___1 = _TIFFmalloc((tmsize_t )sectsize);   13264       tmp___1 = _TIFFmalloc((tmsize_t )sectsize);
13265       sect_buff = (unsigned char *)tmp___1;   13265       sect_buff = (unsigned char *)tmp___1;
13266     } else {   13266     } else {
13267       sect_buff = new_buff;   13267       sect_buff = new_buff;
13268     }   13268     }
13269     _TIFFmemset((void *)sect_buff, 0, (tmsize_t )sectsize);   13269     _TIFFmemset((void *)sect_buff, 0, (tmsize_t )sectsize);
13270   } else {   13270   } else {
13271     13271  
13272   }   13272   }
13273   if (! sect_buff) {   13273   if (! sect_buff) {
13274     TIFFError("createImageSection",   13274     TIFFError("createImageSection",
13275               "Unable to allocate/reallocate section buffer");   13275               "Unable to allocate/reallocate section buffer");
13276     return (-1);   13276     return (-1);
13277   } else {   13277   } else {
13278     13278  
13279   }   13279   }
13280   prev_sectsize = sectsize;   13280   prev_sectsize = sectsize;
13281   *sect_buff_ptr = sect_buff;   13281   *sect_buff_ptr = sect_buff;
13282   return (0);   13282   return (0);
13283 }   13283 }
13284 }   13284 }
13285 static int processCropSelections(struct image_data *image ,   13285 static int processCropSelections(struct image_data *image ,
13286                                  struct crop_mask *crop ,   13286                                  struct crop_mask *crop ,
13287                                  unsigned char **read_buff_ptr ,   13287                                  unsigned char **read_buff_ptr ,
13288                                  struct buffinfo *seg_buffs )   13288                                  struct buffinfo *seg_buffs )
13289 {   13289 {
13290   int i ;   13290   int i ;
13291   uint32 width ;   13291   uint32 width ;
13292   uint32 length ;   13292   uint32 length ;
13293   uint32 total_width ;   13293   uint32 total_width ;
13294   uint32 total_length ;   13294   uint32 total_length ;
13295   tsize_t cropsize ;   13295   tsize_t cropsize ;
13296   unsigned char *crop_buff ;   13296   unsigned char *crop_buff ;
13297   unsigned char *read_buff ;   13297   unsigned char *read_buff ;
13298   unsigned char *next_buff ;   13298   unsigned char *next_buff ;
13299   tsize_t prev_cropsize ;   13299   tsize_t prev_cropsize ;
13300   void *tmp ;   13300   void *tmp ;
13301   void *tmp___0 ;   13301   void *tmp___0 ;
13302   void *tmp___1 ;   13302   void *tmp___1 ;
13303   int tmp___2 ;   13303   int tmp___2 ;
13304   int tmp___3 ;   13304   int tmp___3 ;
13305   char const   *tmp___4 ;   13305   char const   *tmp___4 ;
13306   int tmp___5 ;   13306   int tmp___5 ;
13307   int tmp___6 ;   13307   int tmp___6 ;
13308   void *tmp___7 ;   13308   void *tmp___7 ;
13309   void *tmp___8 ;   13309   void *tmp___8 ;
13310   void *tmp___9 ;   13310   void *tmp___9 ;
13311   int tmp___10 ;   13311   int tmp___10 ;
13312   int tmp___11 ;   13312   int tmp___11 ;
13313   char const   *tmp___12 ;   13313   char const   *tmp___12 ;
13314   int tmp___13 ;   13314   int tmp___13 ;
13315   int tmp___14 ;   13315   int tmp___14 ;
13316     13316  
13317   {   13317   {
13318   crop_buff = (unsigned char *)((void *)0);   13318   crop_buff = (unsigned char *)((void *)0);
13319   read_buff = (unsigned char *)((void *)0);   13319   read_buff = (unsigned char *)((void *)0);
13320   next_buff = (unsigned char *)((void *)0);   13320   next_buff = (unsigned char *)((void *)0);
13321   prev_cropsize = (tsize_t )0;   13321   prev_cropsize = (tsize_t )0;
13322   read_buff = *read_buff_ptr;   13322   read_buff = *read_buff_ptr;
13323   if ((int )crop->img_mode == 0) {   13323   if ((int )crop->img_mode == 0) {
13324     cropsize = (tsize_t )crop->bufftotal;   13324     cropsize = (tsize_t )crop->bufftotal;
13325     crop_buff = (seg_buffs + 0)->buffer;   13325     crop_buff = (seg_buffs + 0)->buffer;
13326     if (! crop_buff) {   13326     if (! crop_buff) {
13327       tmp = _TIFFmalloc(cropsize);   13327       tmp = _TIFFmalloc(cropsize);
13328       crop_buff = (unsigned char *)tmp;   13328       crop_buff = (unsigned char *)tmp;
13329     } else {   13329     } else {
13330       prev_cropsize = (tsize_t )(seg_buffs + 0)->size;   13330       prev_cropsize = (tsize_t )(seg_buffs + 0)->size;
13331       if (prev_cropsize < cropsize) {   13331       if (prev_cropsize < cropsize) {
13332         tmp___0 = _TIFFrealloc((void *)crop_buff, cropsize);   13332         tmp___0 = _TIFFrealloc((void *)crop_buff, cropsize);
13333         next_buff = (unsigned char *)tmp___0;   13333         next_buff = (unsigned char *)tmp___0;
13334         if (! next_buff) {   13334         if (! next_buff) {
13335           _TIFFfree((void *)crop_buff);   13335           _TIFFfree((void *)crop_buff);
13336           tmp___1 = _TIFFmalloc(cropsize);   13336           tmp___1 = _TIFFmalloc(cropsize);
13337           crop_buff = (unsigned char *)tmp___1;   13337           crop_buff = (unsigned char *)tmp___1;
13338         } else {   13338         } else {
13339           crop_buff = next_buff;   13339           crop_buff = next_buff;
13340         }   13340         }
13341       } else {   13341       } else {
13342     13342  
13343       }   13343       }
13344     }   13344     }
13345     if (! crop_buff) {   13345     if (! crop_buff) {
13346       TIFFError("processCropSelections",   13346       TIFFError("processCropSelections",
13347                 "Unable to allocate/reallocate crop buffer");   13347                 "Unable to allocate/reallocate crop buffer");
13348       return (-1);   13348       return (-1);
13349     } else {   13349     } else {
13350     13350  
13351     }   13351     }
13352     _TIFFmemset((void *)crop_buff, 0, cropsize);   13352     _TIFFmemset((void *)crop_buff, 0, cropsize);
13353     (seg_buffs + 0)->buffer = crop_buff;   13353     (seg_buffs + 0)->buffer = crop_buff;
13354     (seg_buffs + 0)->size = (uint32 )cropsize;   13354     (seg_buffs + 0)->size = (uint32 )cropsize;
13355     tmp___2 = extractCompositeRegions(image, crop, read_buff, crop_buff);   13355     tmp___2 = extractCompositeRegions(image, crop, read_buff, crop_buff);
13356     if (tmp___2 != 0) {   13356     if (tmp___2 != 0) {
13357       return (1);   13357       return (1);
13358     } else {   13358     } else {
13359     13359  
13360     }   13360     }
13361     if ((int )crop->crop_mode & 128) {   13361     if ((int )crop->crop_mode & 128) {
13362       switch ((int )crop->photometric) {   13362       switch ((int )crop->photometric) {
13363       case 1:   13363       case 1:
13364       case 0:   13364       case 0:
13365       image->photometric = crop->photometric;   13365       image->photometric = crop->photometric;
13366       break;   13366       break;
13367       case 11:   13367       case 11:
13368       case 10:   13368       case 10:
13369       tmp___3 = invertImage(image->photometric, image->spp, image->bps,   13369       tmp___3 = invertImage(image->photometric, image->spp, image->bps,
13370                             crop->combined_width, crop->combined_length,   13370                             crop->combined_width, crop->combined_length,
13371                             crop_buff);   13371                             crop_buff);
13372       if (tmp___3) {   13372       if (tmp___3) {
13373         TIFFError("processCropSelections",   13373         TIFFError("processCropSelections",
13374                   "Failed to invert colorspace for composite regions");   13374                   "Failed to invert colorspace for composite regions");
13375         return (-1);   13375         return (-1);
13376       } else {   13376       } else {
13377     13377  
13378       }   13378       }
13379       if ((int )crop->photometric == 11) {   13379       if ((int )crop->photometric == 11) {
13380         switch ((int )image->photometric) {   13380         switch ((int )image->photometric) {
13381         case 0:   13381         case 0:
13382         image->photometric = (uint16 )1;   13382         image->photometric = (uint16 )1;
13383         break;   13383         break;
13384         case 1:   13384         case 1:
13385         image->photometric = (uint16 )0;   13385         image->photometric = (uint16 )0;
13386         break;   13386         break;
13387         default:   13387         default:
13388         break;   13388         break;
13389         }   13389         }
13390       } else {   13390       } else {
13391     13391  
13392       }   13392       }
13393       break;   13393       break;
13394       default:   13394       default:
13395       break;   13395       break;
13396       }   13396       }
13397     } else {   13397     } else {
13398     13398  
13399     }   13399     }
13400     if ((int )crop->crop_mode & 64) {   13400     if ((int )crop->crop_mode & 64) {
13401       tmp___5 = mirrorImage(image->spp, image->bps, crop->mirror,   13401       tmp___5 = mirrorImage(image->spp, image->bps, crop->mirror,
13402                             crop->combined_width, crop->combined_length,   13402                             crop->combined_width, crop->combined_length,
13403                             crop_buff);   13403                             crop_buff);
13404       if (tmp___5) {   13404       if (tmp___5) {
13405         if ((int )crop->rotation == 1) {   13405         if ((int )crop->rotation == 1) {
13406           tmp___4 = "horizontally";   13406           tmp___4 = "horizontally";
13407         } else {   13407         } else {
13408           tmp___4 = "vertically";   13408           tmp___4 = "vertically";
13409         }   13409         }
13410         TIFFError("processCropSelections",   13410         TIFFError("processCropSelections",
13411                   "Failed to mirror composite regions %s", tmp___4);   13411                   "Failed to mirror composite regions %s", tmp___4);
13412         return (-1);   13412         return (-1);
13413       } else {   13413       } else {
13414     13414  
13415       }   13415       }
13416     } else {   13416     } else {
13417     13417  
13418     }   13418     }
13419     if ((int )crop->crop_mode & 32) {   13419     if ((int )crop->crop_mode & 32) {
13420       tmp___6 = rotateImage(crop->rotation, image, & crop->combined_width,   13420       tmp___6 = rotateImage(crop->rotation, image, & crop->combined_width,
13421                             & crop->combined_length, & crop_buff);   13421                             & crop->combined_length, & crop_buff);
13422       if (tmp___6) {   13422       if (tmp___6) {
13423         TIFFError("processCropSelections",   13423         TIFFError("processCropSelections",
13424                   "Failed to rotate composite regions by %d degrees",   13424                   "Failed to rotate composite regions by %d degrees",
13425                   (int )crop->rotation);   13425                   (int )crop->rotation);
13426         return (-1);   13426         return (-1);
13427       } else {   13427       } else {
13428     13428  
13429       }   13429       }
13430       (seg_buffs + 0)->buffer = crop_buff;   13430       (seg_buffs + 0)->buffer = crop_buff;
13431       (seg_buffs + 0)->size = (((crop->combined_width * (uint32 )image->bps + 7U) / 8U) * (uint32 )image->spp) * crop->combined_length;   13431       (seg_buffs + 0)->size = (((crop->combined_width * (uint32 )image->bps + 7U) / 8U) * (uint32 )image->spp) * crop->combined_length;
13432     } else {   13432     } else {
13433     13433  
13434     }   13434     }
13435   } else {   13435   } else {
13436     total_length = (uint32 )0;   13436     total_length = (uint32 )0;
13437     total_width = total_length;   13437     total_width = total_length;
13438     i = 0;   13438     i = 0;
13439     while (i < (int )crop->selections) {   13439     while (i < (int )crop->selections) {
13440       cropsize = (tsize_t )crop->bufftotal;   13440       cropsize = (tsize_t )crop->bufftotal;
13441       crop_buff = (seg_buffs + i)->buffer;   13441       crop_buff = (seg_buffs + i)->buffer;
13442       if (! crop_buff) {   13442       if (! crop_buff) {
13443         tmp___7 = _TIFFmalloc(cropsize);   13443         tmp___7 = _TIFFmalloc(cropsize);
13444         crop_buff = (unsigned char *)tmp___7;   13444         crop_buff = (unsigned char *)tmp___7;
13445       } else {   13445       } else {
13446         prev_cropsize = (tsize_t )(seg_buffs + 0)->size;   13446         prev_cropsize = (tsize_t )(seg_buffs + 0)->size;
13447         if (prev_cropsize < cropsize) {   13447         if (prev_cropsize < cropsize) {
13448           tmp___8 = _TIFFrealloc((void *)crop_buff, cropsize);   13448           tmp___8 = _TIFFrealloc((void *)crop_buff, cropsize);
13449           next_buff = (unsigned char *)tmp___8;   13449           next_buff = (unsigned char *)tmp___8;
13450           if (! next_buff) {   13450           if (! next_buff) {
13451             _TIFFfree((void *)crop_buff);   13451             _TIFFfree((void *)crop_buff);
13452             tmp___9 = _TIFFmalloc(cropsize);   13452             tmp___9 = _TIFFmalloc(cropsize);
13453             crop_buff = (unsigned char *)tmp___9;   13453             crop_buff = (unsigned char *)tmp___9;
13454           } else {   13454           } else {
13455             crop_buff = next_buff;   13455             crop_buff = next_buff;
13456           }   13456           }
13457         } else {   13457         } else {
13458     13458  
13459         }   13459         }
13460       }   13460       }
13461       if (! crop_buff) {   13461       if (! crop_buff) {
13462         TIFFError("processCropSelections",   13462         TIFFError("processCropSelections",
13463                   "Unable to allocate/reallocate crop buffer");   13463                   "Unable to allocate/reallocate crop buffer");
13464         return (-1);   13464         return (-1);
13465       } else {   13465       } else {
13466     13466  
13467       }   13467       }
13468       _TIFFmemset((void *)crop_buff, 0, cropsize);   13468       _TIFFmemset((void *)crop_buff, 0, cropsize);
13469       (seg_buffs + i)->buffer = crop_buff;   13469       (seg_buffs + i)->buffer = crop_buff;
13470       (seg_buffs + i)->size = (uint32 )cropsize;   13470       (seg_buffs + i)->size = (uint32 )cropsize;
13471       tmp___10 = extractSeparateRegion(image, crop, read_buff, crop_buff, i);   13471       tmp___10 = extractSeparateRegion(image, crop, read_buff, crop_buff, i);
13472       if (tmp___10) {   13472       if (tmp___10) {
13473         TIFFError("processCropSelections",   13473         TIFFError("processCropSelections",
13474                   "Unable to extract cropped region %d from image", i);   13474                   "Unable to extract cropped region %d from image", i);
13475         return (-1);   13475         return (-1);
13476       } else {   13476       } else {
13477     13477  
13478       }   13478       }
13479       width = crop->regionlist[i].width;   13479       width = crop->regionlist[i].width;
13480       length = crop->regionlist[i].length;   13480       length = crop->regionlist[i].length;
13481       if ((int )crop->crop_mode & 128) {   13481       if ((int )crop->crop_mode & 128) {
13482         switch ((int )crop->photometric) {   13482         switch ((int )crop->photometric) {
13483         case 1:   13483         case 1:
13484         case 0:   13484         case 0:
13485         image->photometric = crop->photometric;   13485         image->photometric = crop->photometric;
13486         break;   13486         break;
13487         case 11:   13487         case 11:
13488         case 10:   13488         case 10:
13489         tmp___11 = invertImage(image->photometric, image->spp, image->bps,   13489         tmp___11 = invertImage(image->photometric, image->spp, image->bps,
13490                                width, length, crop_buff);   13490                                width, length, crop_buff);
13491         if (tmp___11) {   13491         if (tmp___11) {
13492           TIFFError("processCropSelections",   13492           TIFFError("processCropSelections",
13493                     "Failed to invert colorspace for region");   13493                     "Failed to invert colorspace for region");
13494           return (-1);   13494           return (-1);
13495         } else {   13495         } else {
13496     13496  
13497         }   13497         }
13498         if ((int )crop->photometric == 11) {   13498         if ((int )crop->photometric == 11) {
13499           switch ((int )image->photometric) {   13499           switch ((int )image->photometric) {
13500           case 0:   13500           case 0:
13501           image->photometric = (uint16 )1;   13501           image->photometric = (uint16 )1;
13502           break;   13502           break;
13503           case 1:   13503           case 1:
13504           image->photometric = (uint16 )0;   13504           image->photometric = (uint16 )0;
13505           break;   13505           break;
13506           default:   13506           default:
13507           break;   13507           break;
13508           }   13508           }
13509         } else {   13509         } else {
13510     13510  
13511         }   13511         }
13512         break;   13512         break;
13513         default:   13513         default:
13514         break;   13514         break;
13515         }   13515         }
13516       } else {   13516       } else {
13517     13517  
13518       }   13518       }
13519       if ((int )crop->crop_mode & 64) {   13519       if ((int )crop->crop_mode & 64) {
13520         tmp___13 = mirrorImage(image->spp, image->bps, crop->mirror, width,   13520         tmp___13 = mirrorImage(image->spp, image->bps, crop->mirror, width,
13521                                length, crop_buff);   13521                                length, crop_buff);
13522         if (tmp___13) {   13522         if (tmp___13) {
13523           if ((int )crop->rotation == 1) {   13523           if ((int )crop->rotation == 1) {
13524             tmp___12 = "horizontally";   13524             tmp___12 = "horizontally";
13525           } else {   13525           } else {
13526             tmp___12 = "vertically";   13526             tmp___12 = "vertically";
13527           }   13527           }
13528           TIFFError("processCropSelections", "Failed to mirror crop region %s",   13528           TIFFError("processCropSelections", "Failed to mirror crop region %s",
13529                     tmp___12);   13529                     tmp___12);
13530           return (-1);   13530           return (-1);
13531         } else {   13531         } else {
13532     13532  
13533         }   13533         }
13534       } else {   13534       } else {
13535     13535  
13536       }   13536       }
13537       if ((int )crop->crop_mode & 32) {   13537       if ((int )crop->crop_mode & 32) {
13538         tmp___14 = rotateImage(crop->rotation, image,   13538         tmp___14 = rotateImage(crop->rotation, image,
13539                                & crop->regionlist[i].width,   13539                                & crop->regionlist[i].width,
13540                                & crop->regionlist[i].length, & crop_buff);   13540                                & crop->regionlist[i].length, & crop_buff);
13541         if (tmp___14) {   13541         if (tmp___14) {
13542           TIFFError("processCropSelections",   13542           TIFFError("processCropSelections",
13543                     "Failed to rotate crop region by %d degrees",   13543                     "Failed to rotate crop region by %d degrees",
13544                     (int )crop->rotation);   13544                     (int )crop->rotation);
13545           return (-1);   13545           return (-1);
13546         } else {   13546         } else {
13547     13547  
13548         }   13548         }
13549         total_width += crop->regionlist[i].width;   13549         total_width += crop->regionlist[i].width;
13550         total_length += crop->regionlist[i].length;   13550         total_length += crop->regionlist[i].length;
13551         crop->combined_width = total_width;   13551         crop->combined_width = total_width;
13552         crop->combined_length = total_length;   13552         crop->combined_length = total_length;
13553         (seg_buffs + i)->buffer = crop_buff;   13553         (seg_buffs + i)->buffer = crop_buff;
13554         (seg_buffs + i)->size = (((crop->regionlist[i].width * (uint32 )image->bps + 7U) / 8U) * (uint32 )image->spp) * crop->regionlist[i].length;   13554         (seg_buffs + i)->size = (((crop->regionlist[i].width * (uint32 )image->bps + 7U) / 8U) * (uint32 )image->spp) * crop->regionlist[i].length;
13555       } else {   13555       } else {
13556     13556  
13557       }   13557       }
13558       i ++;   13558       i ++;
13559     }   13559     }
13560   }   13560   }
13561   return (0);   13561   return (0);
13562 }   13562 }
13563 }   13563 }
13564 static int createCroppedImage(struct image_data *image ,   13564 static int createCroppedImage(struct image_data *image ,
13565                               struct crop_mask *crop ,   13565                               struct crop_mask *crop ,
13566                               unsigned char **read_buff_ptr ,   13566                               unsigned char **read_buff_ptr ,
13567                               unsigned char **crop_buff_ptr ) ;   13567                               unsigned char **crop_buff_ptr ) ;
13568 static tsize_t prev_cropsize  =    (tsize_t )0;   13568 static tsize_t prev_cropsize  =    (tsize_t )0;
13569 static int createCroppedImage(struct image_data *image ,   13569 static int createCroppedImage(struct image_data *image ,
13570                               struct crop_mask *crop ,   13570                               struct crop_mask *crop ,
13571                               unsigned char **read_buff_ptr ,   13571                               unsigned char **read_buff_ptr ,
13572                               unsigned char **crop_buff_ptr )   13572                               unsigned char **crop_buff_ptr )
13573 {   13573 {
13574   tsize_t cropsize ;   13574   tsize_t cropsize ;
13575   unsigned char *read_buff ;   13575   unsigned char *read_buff ;
13576   unsigned char *crop_buff ;   13576   unsigned char *crop_buff ;
13577   unsigned char *new_buff ;   13577   unsigned char *new_buff ;
13578   void *tmp ;   13578   void *tmp ;
13579   void *tmp___0 ;   13579   void *tmp___0 ;
13580   void *tmp___1 ;   13580   void *tmp___1 ;
13581   int tmp___2 ;   13581   int tmp___2 ;
13582   char const   *tmp___3 ;   13582   char const   *tmp___3 ;
13583   int tmp___4 ;   13583   int tmp___4 ;
13584   int tmp___5 ;   13584   int tmp___5 ;
13585     13585  
13586   {   13586   {
13587   read_buff = (unsigned char *)((void *)0);   13587   read_buff = (unsigned char *)((void *)0);
13588   crop_buff = (unsigned char *)((void *)0);   13588   crop_buff = (unsigned char *)((void *)0);
13589   new_buff = (unsigned char *)((void *)0);   13589   new_buff = (unsigned char *)((void *)0);
13590   read_buff = *read_buff_ptr;   13590   read_buff = *read_buff_ptr;
13591   crop_buff = read_buff;   13591   crop_buff = read_buff;
13592   *crop_buff_ptr = read_buff;   13592   *crop_buff_ptr = read_buff;
13593   crop->combined_width = image->width;   13593   crop->combined_width = image->width;
13594   crop->combined_length = image->length;   13594   crop->combined_length = image->length;
13595   cropsize = (tsize_t )crop->bufftotal;   13595   cropsize = (tsize_t )crop->bufftotal;
13596   crop_buff = *crop_buff_ptr;   13596   crop_buff = *crop_buff_ptr;
13597   if (! crop_buff) {   13597   if (! crop_buff) {
13598     tmp = _TIFFmalloc(cropsize);   13598     tmp = _TIFFmalloc(cropsize);
13599     crop_buff = (unsigned char *)tmp;   13599     crop_buff = (unsigned char *)tmp;
13600     *crop_buff_ptr = crop_buff;   13600     *crop_buff_ptr = crop_buff;
13601     _TIFFmemset((void *)crop_buff, 0, cropsize);   13601     _TIFFmemset((void *)crop_buff, 0, cropsize);
13602     prev_cropsize = cropsize;   13602     prev_cropsize = cropsize;
13603   } else   13603   } else
13604   if (prev_cropsize < cropsize) {   13604   if (prev_cropsize < cropsize) {
13605     tmp___0 = _TIFFrealloc((void *)crop_buff, cropsize);   13605     tmp___0 = _TIFFrealloc((void *)crop_buff, cropsize);
13606     new_buff = (unsigned char *)tmp___0;   13606     new_buff = (unsigned char *)tmp___0;
13607     if (! new_buff) {   13607     if (! new_buff) {
13608       free((void *)crop_buff);   13608       free((void *)crop_buff);
13609       tmp___1 = _TIFFmalloc(cropsize);   13609       tmp___1 = _TIFFmalloc(cropsize);
13610       crop_buff = (unsigned char *)tmp___1;   13610       crop_buff = (unsigned char *)tmp___1;
13611     } else {   13611     } else {
13612       crop_buff = new_buff;   13612       crop_buff = new_buff;
13613     }   13613     }
13614     _TIFFmemset((void *)crop_buff, 0, cropsize);   13614     _TIFFmemset((void *)crop_buff, 0, cropsize);
13615   } else {   13615   } else {
13616     13616  
13617   }   13617   }
13618   if (! crop_buff) {   13618   if (! crop_buff) {
13619     TIFFError("createCroppedImage", "Unable to allocate/reallocate crop buffer");   13619     TIFFError("createCroppedImage", "Unable to allocate/reallocate crop buffer");
13620     return (-1);   13620     return (-1);
13621   } else {   13621   } else {
13622     13622  
13623   }   13623   }
13624   *crop_buff_ptr = crop_buff;   13624   *crop_buff_ptr = crop_buff;
13625   if ((int )crop->crop_mode & 128) {   13625   if ((int )crop->crop_mode & 128) {
13626     switch ((int )crop->photometric) {   13626     switch ((int )crop->photometric) {
13627     case 1:   13627     case 1:
13628     case 0:   13628     case 0:
13629     image->photometric = crop->photometric;   13629     image->photometric = crop->photometric;
13630     break;   13630     break;
13631     case 11:   13631     case 11:
13632     case 10:   13632     case 10:
13633     tmp___2 = invertImage(image->photometric, image->spp, image->bps,   13633     tmp___2 = invertImage(image->photometric, image->spp, image->bps,
13634                           crop->combined_width, crop->combined_length, crop_buff);   13634                           crop->combined_width, crop->combined_length, crop_buff);
13635     if (tmp___2) {   13635     if (tmp___2) {
13636       TIFFError("createCroppedImage",   13636       TIFFError("createCroppedImage",
13637                 "Failed to invert colorspace for image or cropped selection");   13637                 "Failed to invert colorspace for image or cropped selection");
13638       return (-1);   13638       return (-1);
13639     } else {   13639     } else {
13640     13640  
13641     }   13641     }
13642     if ((int )crop->photometric == 11) {   13642     if ((int )crop->photometric == 11) {
13643       switch ((int )image->photometric) {   13643       switch ((int )image->photometric) {
13644       case 0:   13644       case 0:
13645       image->photometric = (uint16 )1;   13645       image->photometric = (uint16 )1;
13646       break;   13646       break;
13647       case 1:   13647       case 1:
13648       image->photometric = (uint16 )0;   13648       image->photometric = (uint16 )0;
13649       break;   13649       break;
13650       default:   13650       default:
13651       break;   13651       break;
13652       }   13652       }
13653     } else {   13653     } else {
13654     13654  
13655     }   13655     }
13656     break;   13656     break;
13657     default:   13657     default:
13658     break;   13658     break;
13659     }   13659     }
13660   } else {   13660   } else {
13661     13661  
13662   }   13662   }
13663   if ((int )crop->crop_mode & 64) {   13663   if ((int )crop->crop_mode & 64) {
13664     tmp___4 = mirrorImage(image->spp, image->bps, crop->mirror,   13664     tmp___4 = mirrorImage(image->spp, image->bps, crop->mirror,
13665                           crop->combined_width, crop->combined_length, crop_buff);   13665                           crop->combined_width, crop->combined_length, crop_buff);
13666     if (tmp___4) {   13666     if (tmp___4) {
13667       if ((int )crop->rotation == 1) {   13667       if ((int )crop->rotation == 1) {
13668         tmp___3 = "horizontally";   13668         tmp___3 = "horizontally";
13669       } else {   13669       } else {
13670         tmp___3 = "vertically";   13670         tmp___3 = "vertically";
13671       }   13671       }
13672       TIFFError("createCroppedImage",   13672       TIFFError("createCroppedImage",
13673                 "Failed to mirror image or cropped selection %s", tmp___3);   13673                 "Failed to mirror image or cropped selection %s", tmp___3);
13674       return (-1);   13674       return (-1);
13675     } else {   13675     } else {
13676     13676  
13677     }   13677     }
13678   } else {   13678   } else {
13679     13679  
13680   }   13680   }
13681   if ((int )crop->crop_mode & 32) {   13681   if ((int )crop->crop_mode & 32) {
13682     tmp___5 = rotateImage(crop->rotation, image, & crop->combined_width,   13682     tmp___5 = rotateImage(crop->rotation, image, & crop->combined_width,
13683                           & crop->combined_length, crop_buff_ptr);   13683                           & crop->combined_length, crop_buff_ptr);
13684     if (tmp___5) {   13684     if (tmp___5) {
13685       TIFFError("createCroppedImage",   13685       TIFFError("createCroppedImage",
13686                 "Failed to rotate image or cropped selection by %d degrees",   13686                 "Failed to rotate image or cropped selection by %d degrees",
13687                 (int )crop->rotation);   13687                 (int )crop->rotation);
13688       return (-1);   13688       return (-1);
13689     } else {   13689     } else {
13690     13690  
13691     }   13691     }
13692   } else {   13692   } else {
13693     13693  
13694   }   13694   }
13695   if ((unsigned int )crop_buff == (unsigned int )read_buff) {   13695   if ((unsigned int )crop_buff == (unsigned int )read_buff) {
13696     *read_buff_ptr = (unsigned char *)((void *)0);   13696     *read_buff_ptr = (unsigned char *)((void *)0);
13697   } else {   13697   } else {
13698     13698  
13699   }   13699   }
13700   return (0);   13700   return (0);
13701 }   13701 }
13702 }   13702 }
13703 static int writeCroppedImage(TIFF *in , TIFF *out , struct image_data *image ,   13703 static int writeCroppedImage(TIFF *in , TIFF *out , struct image_data *image ,
13704                              struct dump_opts *dump , uint32 width ,   13704                              struct dump_opts *dump , uint32 width ,
13705                              uint32 length , unsigned char *crop_buff ,   13705                              uint32 length , unsigned char *crop_buff ,
13706                              int pagenum , int total_pages )   13706                              int pagenum , int total_pages )
13707 {   13707 {
13708   uint16 bps ;   13708   uint16 bps ;
13709   uint16 spp ;   13709   uint16 spp ;
13710   struct cpTag *p ;   13710   struct cpTag *p ;
13711   int tmp ;   13711   int tmp ;
13712   int tmp___0 ;   13712   int tmp___0 ;
13713   int tmp___1 ;   13713   int tmp___1 ;
13714   uint16 input_compression ;   13714   uint16 input_compression ;
13715   uint16 input_photometric ;   13715   uint16 input_photometric ;
13716   int tmp___2 ;   13716   int tmp___2 ;
13717   int tmp___3 ;   13717   int tmp___3 ;
13718   int tmp___4 ;   13718   int tmp___4 ;
13719   int tmp___5 ;   13719   int tmp___5 ;
13720   int tmp___6 ;   13720   int tmp___6 ;
13721   int tmp___7 ;   13721   int tmp___7 ;
13722   int tmp___8 ;   13722   int tmp___8 ;
13723   uint32 len32 ;   13723   uint32 len32 ;
13724   void **data ;   13724   void **data ;
13725   int tmp___9 ;   13725   int tmp___9 ;
13726   uint16 ninks ;   13726   uint16 ninks ;
13727   char const   *inknames ;   13727   char const   *inknames ;
13728   int inknameslen ;   13728   int inknameslen ;
13729   size_t tmp___10 ;   13729   size_t tmp___10 ;
13730   char const   *cp ;   13730   char const   *cp ;
13731   void *tmp___11 ;   13731   void *tmp___11 ;
13732   char *tmp___12 ;   13732   char *tmp___12 ;
13733   size_t tmp___13 ;   13733   size_t tmp___13 ;
13734   int tmp___14 ;   13734   int tmp___14 ;
13735   int tmp___15 ;   13735   int tmp___15 ;
13736   unsigned short pg0 ;   13736   unsigned short pg0 ;
13737   unsigned short pg1 ;   13737   unsigned short pg1 ;
13738   int tmp___16 ;   13738   int tmp___16 ;
13739   int tmp___17 ;   13739   int tmp___17 ;
13740     13740  
13741   {   13741   {
13742   TIFFSetField(out, (uint32 )256, width);   13742   TIFFSetField(out, (uint32 )256, width);
13743   TIFFSetField(out, (uint32 )257, length);   13743   TIFFSetField(out, (uint32 )257, length);
13744   tmp = TIFFGetField(in, (uint32 )258, & bps);   13744   tmp = TIFFGetField(in, (uint32 )258, & bps);
13745   if (tmp) {   13745   if (tmp) {
13746     TIFFSetField(out, (uint32 )258, (int )bps);   13746     TIFFSetField(out, (uint32 )258, (int )bps);
13747   } else {   13747   } else {
13748     13748  
13749   }   13749   }
13750   tmp___0 = TIFFGetField(in, (uint32 )277, & spp);   13750   tmp___0 = TIFFGetField(in, (uint32 )277, & spp);
13751   if (tmp___0) {   13751   if (tmp___0) {
13752     TIFFSetField(out, (uint32 )277, (int )spp);   13752     TIFFSetField(out, (uint32 )277, (int )spp);
13753   } else {   13753   } else {
13754     13754  
13755   }   13755   }
13756   if ((int )compression != 65535) {   13756   if ((int )compression != 65535) {
13757     TIFFSetField(out, (uint32 )259, (int )compression);   13757     TIFFSetField(out, (uint32 )259, (int )compression);
13758   } else {   13758   } else {
13759     tmp___1 = TIFFGetField(in, (uint32 )259, & compression);   13759     tmp___1 = TIFFGetField(in, (uint32 )259, & compression);
13760     if (tmp___1) {   13760     if (tmp___1) {
13761       TIFFSetField(out, (uint32 )259, (int )compression);   13761       TIFFSetField(out, (uint32 )259, (int )compression);
13762     } else {   13762     } else {
13763     13763  
13764     }   13764     }
13765   }   13765   }
13766   if ((int )compression == 7) {   13766   if ((int )compression == 7) {
13767     tmp___2 = TIFFGetField(in, (uint32 )259, & input_compression);   13767     tmp___2 = TIFFGetField(in, (uint32 )259, & input_compression);
13768     if (tmp___2) {   13768     if (tmp___2) {
13769       if ((int )input_compression == 7) {   13769       if ((int )input_compression == 7) {
13770         TIFFSetField(in, (uint32 )65538, 1);   13770         TIFFSetField(in, (uint32 )65538, 1);
13771       } else {   13771       } else {
13772     13772  
13773       }   13773       }
13774     } else {   13774     } else {
13775     13775  
13776     }   13776     }
13777     tmp___3 = TIFFGetField(in, (uint32 )262, & input_photometric);   13777     tmp___3 = TIFFGetField(in, (uint32 )262, & input_photometric);
13778     if (tmp___3) {   13778     if (tmp___3) {
13779       if ((int )input_photometric == 2) { <> 13779       if (in != 0) {
13780         if (jpegcolormode == 1) { = 13780         if (jpegcolormode == 1) {
13781           TIFFSetField(out, (uint32 )262, 6);   13781           TIFFSetField(out, (uint32 )262, 6);
13782         } else {   13782         } else {
13783           TIFFSetField(out, (uint32 )262, 2);   13783           TIFFSetField(out, (uint32 )262, 2);
13784         }   13784         }
13785       } else {   13785       } else {
13786         TIFFSetField(out, (uint32 )262, (int )input_photometric);   13786         TIFFSetField(out, (uint32 )262, (int )input_photometric);
13787       }   13787       }
13788     } else {   13788     } else {
13789     13789  
13790     }   13790     }
13791   } else   13791   } else
13792   if ((int )compression == 34676) {   13792   if ((int )compression == 34676) {
13793     goto _L;   13793     goto _L;
13794   } else   13794   } else
13795   if ((int )compression == 34677) {   13795   if ((int )compression == 34677) {
13796     _L: /* CIL Label */   13796     _L: /* CIL Label */
13797     if ((int )spp == 1) {   13797     if ((int )spp == 1) {
13798       tmp___4 = 32844;   13798       tmp___4 = 32844;
13799     } else {   13799     } else {
13800       tmp___4 = 32845;   13800       tmp___4 = 32845;
13801     }   13801     }
13802     TIFFSetField(out, (uint32 )262, tmp___4);   13802     TIFFSetField(out, (uint32 )262, tmp___4);
13803   } else {   13803   } else {
13804     TIFFSetField(out, (uint32 )262, (int )image->photometric);   13804     TIFFSetField(out, (uint32 )262, (int )image->photometric);
13805   }   13805   }
13806   if ((int )fillorder != 0) {   13806   if ((int )fillorder != 0) {
13807     TIFFSetField(out, (uint32 )266, (int )fillorder);   13807     TIFFSetField(out, (uint32 )266, (int )fillorder);
13808   } else {   13808   } else {
13809     cpTag(in, out, (uint16 )266, (uint16 )1, (TIFFDataType )3);   13809     cpTag(in, out, (uint16 )266, (uint16 )1, (TIFFDataType )3);
13810   }   13810   }
13811   TIFFSetField(out, (uint32 )274, (int )image->orientation);   13811   TIFFSetField(out, (uint32 )274, (int )image->orientation);
13812   if (outtiled == -1) {   13812   if (outtiled == -1) {
13813     outtiled = TIFFIsTiled(in);   13813     outtiled = TIFFIsTiled(in);
13814   } else {   13814   } else {
13815     13815  
13816   }   13816   }
13817   if (outtiled) {   13817   if (outtiled) {
13818     if (tilewidth == 4294967295U) {   13818     if (tilewidth == 4294967295U) {
13819       TIFFGetField(in, (uint32 )322, & tilewidth);   13819       TIFFGetField(in, (uint32 )322, & tilewidth);
13820     } else {   13820     } else {
13821     13821  
13822     }   13822     }
13823     if (tilelength == 4294967295U) {   13823     if (tilelength == 4294967295U) {
13824       TIFFGetField(in, (uint32 )323, & tilelength);   13824       TIFFGetField(in, (uint32 )323, & tilelength);
13825     } else {   13825     } else {
13826     13826  
13827     }   13827     }
13828     if (tilewidth > width) {   13828     if (tilewidth > width) {
13829       tilewidth = width;   13829       tilewidth = width;
13830     } else {   13830     } else {
13831     13831  
13832     }   13832     }
13833     if (tilelength > length) {   13833     if (tilelength > length) {
13834       tilelength = length;   13834       tilelength = length;
13835     } else {   13835     } else {
13836     13836  
13837     }   13837     }
13838     TIFFDefaultTileSize(out, & tilewidth, & tilelength);   13838     TIFFDefaultTileSize(out, & tilewidth, & tilelength);
13839     TIFFSetField(out, (uint32 )322, tilewidth);   13839     TIFFSetField(out, (uint32 )322, tilewidth);
13840     TIFFSetField(out, (uint32 )323, tilelength);   13840     TIFFSetField(out, (uint32 )323, tilelength);
13841   } else {   13841   } else {
13842     if (rowsperstrip == 0U) {   13842     if (rowsperstrip == 0U) {
13843       tmp___5 = TIFFGetField(in, (uint32 )278, & rowsperstrip);   13843       tmp___5 = TIFFGetField(in, (uint32 )278, & rowsperstrip);
13844       if (tmp___5) {   13844       if (tmp___5) {
13845     13845  
13846       } else {   13846       } else {
13847         rowsperstrip = TIFFDefaultStripSize(out, rowsperstrip);   13847         rowsperstrip = TIFFDefaultStripSize(out, rowsperstrip);
13848       }   13848       }
13849       if (rowsperstrip > length) {   13849       if (rowsperstrip > length) {
13850         rowsperstrip = length;   13850         rowsperstrip = length;
13851       } else {   13851       } else {
13852     13852  
13853       }   13853       }
13854     } else   13854     } else
13855     if (rowsperstrip == 4294967295U) {   13855     if (rowsperstrip == 4294967295U) {
13856       rowsperstrip = length;   13856       rowsperstrip = length;
13857     } else {   13857     } else {
13858     13858  
13859     }   13859     }
13860     TIFFSetField(out, (uint32 )278, rowsperstrip);   13860     TIFFSetField(out, (uint32 )278, rowsperstrip);
13861   }   13861   }
13862   if ((int )config != 65535) {   13862   if ((int )config != 65535) {
13863     TIFFSetField(out, (uint32 )284, (int )config);   13863     TIFFSetField(out, (uint32 )284, (int )config);
13864   } else {   13864   } else {
13865     tmp___6 = TIFFGetField(in, (uint32 )284, & config);   13865     tmp___6 = TIFFGetField(in, (uint32 )284, & config);
13866     if (tmp___6) {   13866     if (tmp___6) {
13867       TIFFSetField(out, (uint32 )284, (int )config);   13867       TIFFSetField(out, (uint32 )284, (int )config);
13868     } else {   13868     } else {
13869     13869  
13870     }   13870     }
13871   }   13871   }
13872   if ((int )spp <= 4) {   13872   if ((int )spp <= 4) {
13873     cpTag(in, out, (uint16 )301, (uint16 )4, (TIFFDataType )3);   13873     cpTag(in, out, (uint16 )301, (uint16 )4, (TIFFDataType )3);
13874   } else {   13874   } else {
13875     13875  
13876   }   13876   }
13877   cpTag(in, out, (uint16 )320, (uint16 )4, (TIFFDataType )3);   13877   cpTag(in, out, (uint16 )320, (uint16 )4, (TIFFDataType )3);
13878   switch ((int )compression) {   13878   switch ((int )compression) {
13879   case 7:   13879   case 7:
13880   TIFFSetField(out, (uint32 )65537, quality);   13880   TIFFSetField(out, (uint32 )65537, quality);
13881   TIFFSetField(out, (uint32 )65538, jpegcolormode);   13881   TIFFSetField(out, (uint32 )65538, jpegcolormode);
13882   break;   13882   break;
13883   case 32946:   13883   case 32946:
13884   case 8:   13884   case 8:
13885   case 5:   13885   case 5:
13886   if ((int )predictor != 65535) {   13886   if ((int )predictor != 65535) {
13887     TIFFSetField(out, (uint32 )317, (int )predictor);   13887     TIFFSetField(out, (uint32 )317, (int )predictor);
13888   } else {   13888   } else {
13889     tmp___7 = TIFFGetField(in, (uint32 )317, & predictor);   13889     tmp___7 = TIFFGetField(in, (uint32 )317, & predictor);
13890     if (tmp___7) {   13890     if (tmp___7) {
13891       TIFFSetField(out, (uint32 )317, (int )predictor);   13891       TIFFSetField(out, (uint32 )317, (int )predictor);
13892     } else {   13892     } else {
13893     13893  
13894     }   13894     }
13895   }   13895   }
13896   break;   13896   break;
13897   case 4:   13897   case 4:
13898   case 3:   13898   case 3:
13899   if ((int )compression == 3) {   13899   if ((int )compression == 3) {
13900     if (g3opts != 4294967295U) {   13900     if (g3opts != 4294967295U) {
13901       TIFFSetField(out, (uint32 )292, g3opts);   13901       TIFFSetField(out, (uint32 )292, g3opts);
13902     } else {   13902     } else {
13903       tmp___8 = TIFFGetField(in, (uint32 )292, & g3opts);   13903       tmp___8 = TIFFGetField(in, (uint32 )292, & g3opts);
13904       if (tmp___8) {   13904       if (tmp___8) {
13905         TIFFSetField(out, (uint32 )292, g3opts);   13905         TIFFSetField(out, (uint32 )292, g3opts);
13906       } else {   13906       } else {
13907     13907  
13908       }   13908       }
13909     }   13909     }
13910   } else {   13910   } else {
13911     cpTag(in, out, (uint16 )293, (uint16 )1, (TIFFDataType )4);   13911     cpTag(in, out, (uint16 )293, (uint16 )1, (TIFFDataType )4);
13912   }   13912   }
13913   cpTag(in, out, (uint16 )326, (uint16 )1, (TIFFDataType )4);   13913   cpTag(in, out, (uint16 )326, (uint16 )1, (TIFFDataType )4);
13914   cpTag(in, out, (uint16 )327, (uint16 )1, (TIFFDataType )4);   13914   cpTag(in, out, (uint16 )327, (uint16 )1, (TIFFDataType )4);
13915   cpTag(in, out, (uint16 )328, (uint16 )1, (TIFFDataType )4);   13915   cpTag(in, out, (uint16 )328, (uint16 )1, (TIFFDataType )4);
13916   cpTag(in, out, (uint16 )34908, (uint16 )1, (TIFFDataType )4);   13916   cpTag(in, out, (uint16 )34908, (uint16 )1, (TIFFDataType )4);
13917   cpTag(in, out, (uint16 )34910, (uint16 )1, (TIFFDataType )4);   13917   cpTag(in, out, (uint16 )34910, (uint16 )1, (TIFFDataType )4);
13918   cpTag(in, out, (uint16 )34909, (uint16 )1, (TIFFDataType )2);   13918   cpTag(in, out, (uint16 )34909, (uint16 )1, (TIFFDataType )2);
13919   break;   13919   break;
13920   }   13920   }
13921   tmp___9 = TIFFGetField(in, (uint32 )34675, & len32, & data);   13921   tmp___9 = TIFFGetField(in, (uint32 )34675, & len32, & data);
13922   if (tmp___9) {   13922   if (tmp___9) {
13923     TIFFSetField(out, (uint32 )34675, len32, data);   13923     TIFFSetField(out, (uint32 )34675, len32, data);
13924   } else {   13924   } else {
13925     13925  
13926   }   13926   }
13927   tmp___15 = TIFFGetField(in, (uint32 )334, & ninks);   13927   tmp___15 = TIFFGetField(in, (uint32 )334, & ninks);
13928   if (tmp___15) {   13928   if (tmp___15) {
13929     TIFFSetField(out, (uint32 )334, (int )ninks);   13929     TIFFSetField(out, (uint32 )334, (int )ninks);
13930     tmp___14 = TIFFGetField(in, (uint32 )333, & inknames);   13930     tmp___14 = TIFFGetField(in, (uint32 )333, & inknames);
13931     if (tmp___14) {   13931     if (tmp___14) {
13932       tmp___10 = strlen(inknames);   13932       tmp___10 = strlen(inknames);
13933       inknameslen = (int )(tmp___10 + 1U);   13933       inknameslen = (int )(tmp___10 + 1U);
13934       cp = inknames;   13934       cp = inknames;
13935       while ((int )ninks > 1) {   13935       while ((int )ninks > 1) {
13936         tmp___11 = __rawmemchr((void const   *)cp, '\000');   13936         tmp___11 = __rawmemchr((void const   *)cp, '\000');
13937         cp = (char const   *)((char *)tmp___11);   13937         cp = (char const   *)((char *)tmp___11);
13938         if (cp) {   13938         if (cp) {
13939           cp ++;   13939           cp ++;
13940           tmp___13 = strlen(cp);   13940           tmp___13 = strlen(cp);
13941           inknameslen = (int )((size_t )inknameslen + (tmp___13 + 1U));   13941           inknameslen = (int )((size_t )inknameslen + (tmp___13 + 1U));
13942         } else {   13942         } else {
13943     13943  
13944         }   13944         }
13945         ninks = (uint16 )((int )ninks - 1);   13945         ninks = (uint16 )((int )ninks - 1);
13946       }   13946       }
13947       TIFFSetField(out, (uint32 )333, inknameslen, inknames);   13947       TIFFSetField(out, (uint32 )333, inknameslen, inknames);
13948     } else {   13948     } else {
13949     13949  
13950     }   13950     }
13951   } else {   13951   } else {
13952     13952  
13953   }   13953   }
13954   tmp___16 = TIFFGetField(in, (uint32 )297, & pg0, & pg1);   13954   tmp___16 = TIFFGetField(in, (uint32 )297, & pg0, & pg1);
13955   if (tmp___16) {   13955   if (tmp___16) {
13956     TIFFSetField(out, (uint32 )297, pagenum, total_pages);   13956     TIFFSetField(out, (uint32 )297, pagenum, total_pages);
13957   } else {   13957   } else {
13958     13958  
13959   }   13959   }
13960   p = tags;   13960   p = tags;
13961   while ((unsigned int )p < (unsigned int )(& tags[sizeof(tags) / sizeof(tags[0])])) {   13961   while ((unsigned int )p < (unsigned int )(& tags[sizeof(tags) / sizeof(tags[0])])) {
13962     cpTag(in, out, p->tag, p->count, p->type);   13962     cpTag(in, out, p->tag, p->count, p->type);
13963     p ++;   13963     p ++;
13964   }   13964   }
13965   if (outtiled) {   13965   if (outtiled) {
13966     if ((int )config == 1) {   13966     if ((int )config == 1) {
13967       writeBufferToContigTiles(out, crop_buff, length, width, spp);   13967       writeBufferToContigTiles(out, crop_buff, length, width, spp);
13968     } else {   13968     } else {
13969       writeBufferToSeparateTiles(out, crop_buff, length, width, spp, dump);   13969       writeBufferToSeparateTiles(out, crop_buff, length, width, spp, dump);
13970     }   13970     }
13971   } else   13971   } else
13972   if ((int )config == 1) {   13972   if ((int )config == 1) {
13973     writeBufferToContigStrips(out, crop_buff, length, width, spp);   13973     writeBufferToContigStrips(out, crop_buff, length, width, spp);
13974   } else {   13974   } else {
13975     writeBufferToSeparateStrips(out, crop_buff, length, width, spp, dump);   13975     writeBufferToSeparateStrips(out, crop_buff, length, width, spp, dump);
13976   }   13976   }
13977   tmp___17 = TIFFWriteDirectory(out);   13977   tmp___17 = TIFFWriteDirectory(out);
13978   if (tmp___17) {   13978   if (tmp___17) {
13979     13979  
13980   } else {   13980   } else {
13981     TIFFClose(out);   13981     TIFFClose(out);
13982     return (-1);   13982     return (-1);
13983   }   13983   }
13984   return (0);   13984   return (0);
13985 }   13985 }
13986 }   13986 }
13987 static int rotateContigSamples8bits(uint16 rotation , uint16 spp , uint16 bps ,   13987 static int rotateContigSamples8bits(uint16 rotation , uint16 spp , uint16 bps ,
13988                                     uint32 width , uint32 length , uint32 col ,   13988                                     uint32 width , uint32 length , uint32 col ,
13989                                     uint8 *src , uint8 *dst )   13989                                     uint8 *src , uint8 *dst )
13990 {   13990 {
13991   int ready_bits ;   13991   int ready_bits ;
13992   uint32 src_byte ;   13992   uint32 src_byte ;
13993   uint32 src_bit ;   13993   uint32 src_bit ;
13994   uint32 row ;   13994   uint32 row ;
13995   uint32 rowsize ;   13995   uint32 rowsize ;
13996   uint32 bit_offset ;   13996   uint32 bit_offset ;
13997   uint8 matchbits ;   13997   uint8 matchbits ;
13998   uint8 maskbits ;   13998   uint8 maskbits ;
13999   uint8 buff1 ;   13999   uint8 buff1 ;
14000   uint8 buff2 ;   14000   uint8 buff2 ;
14001   uint8 *next ;   14001   uint8 *next ;
14002   tsample_t sample ;   14002   tsample_t sample ;
14003   uint8 *tmp ;   14003   uint8 *tmp ;
14004   uint8 *tmp___0 ;   14004   uint8 *tmp___0 ;
14005     14005  
14006   {   14006   {
14007   ready_bits = 0;   14007   ready_bits = 0;
14008   src_byte = (uint32 )0;   14008   src_byte = (uint32 )0;
14009   src_bit = (uint32 )0;   14009   src_bit = (uint32 )0;
14010   rowsize = (uint32 )0;   14010   rowsize = (uint32 )0;
14011   bit_offset = (uint32 )0;   14011   bit_offset = (uint32 )0;
14012   matchbits = (uint8 )0;   14012   matchbits = (uint8 )0;
14013   maskbits = (uint8 )0;   14013   maskbits = (uint8 )0;
14014   buff1 = (uint8 )0;   14014   buff1 = (uint8 )0;
14015   buff2 = (uint8 )0;   14015   buff2 = (uint8 )0;
14016   if ((unsigned int )src == (unsigned int )((void *)0)) {   14016   if ((unsigned int )src == (unsigned int )((void *)0)) {
14017     TIFFError("rotateContigSamples8bits", "Invalid src or destination buffer");   14017     TIFFError("rotateContigSamples8bits", "Invalid src or destination buffer");
14018     return (1);   14018     return (1);
14019   } else   14019   } else
14020   if ((unsigned int )dst == (unsigned int )((void *)0)) {   14020   if ((unsigned int )dst == (unsigned int )((void *)0)) {
14021     TIFFError("rotateContigSamples8bits", "Invalid src or destination buffer");   14021     TIFFError("rotateContigSamples8bits", "Invalid src or destination buffer");
14022     return (1);   14022     return (1);
14023   } else {   14023   } else {
14024     14024  
14025   }   14025   }
14026   rowsize = ((uint32 )((int )bps * (int )spp) * width + 7U) / 8U;   14026   rowsize = ((uint32 )((int )bps * (int )spp) * width + 7U) / 8U;
14027   ready_bits = 0;   14027   ready_bits = 0;
14028   maskbits = (uint8 )(255 >> (8 - (int )bps));   14028   maskbits = (uint8 )(255 >> (8 - (int )bps));
14029   buff2 = (uint8 )0;   14029   buff2 = (uint8 )0;
14030   buff1 = buff2;   14030   buff1 = buff2;
14031   row = (uint32 )0;   14031   row = (uint32 )0;
14032   while (row < length) {   14032   while (row < length) {
14033     bit_offset = (col * (uint32 )bps) * (uint32 )spp;   14033     bit_offset = (col * (uint32 )bps) * (uint32 )spp;
14034     sample = (tsample_t )0;   14034     sample = (tsample_t )0;
14035     while ((int )sample < (int )spp) {   14035     while ((int )sample < (int )spp) {
14036       if ((int )sample == 0) {   14036       if ((int )sample == 0) {
14037         src_byte = bit_offset / 8U;   14037         src_byte = bit_offset / 8U;
14038         src_bit = bit_offset % 8U;   14038         src_bit = bit_offset % 8U;
14039       } else {   14039       } else {
14040         src_byte = (bit_offset + (uint32 )((int )sample * (int )bps)) / 8U;   14040         src_byte = (bit_offset + (uint32 )((int )sample * (int )bps)) / 8U;
14041         src_bit = (bit_offset + (uint32 )((int )sample * (int )bps)) % 8U;   14041         src_bit = (bit_offset + (uint32 )((int )sample * (int )bps)) % 8U;
14042       }   14042       }
14043       switch ((int )rotation) {   14043       switch ((int )rotation) {
14044       case 90:   14044       case 90:
14045       next = (src + src_byte) - row * rowsize;   14045       next = (src + src_byte) - row * rowsize;
14046       break;   14046       break;
14047       case 270:   14047       case 270:
14048       next = (src + src_byte) + row * rowsize;   14048       next = (src + src_byte) + row * rowsize;
14049       break;   14049       break;
14050       default:   14050       default:
14051       TIFFError("rotateContigSamples8bits", "Invalid rotation %d",   14051       TIFFError("rotateContigSamples8bits", "Invalid rotation %d",
14052                 (int )rotation);   14052                 (int )rotation);
14053       return (1);   14053       return (1);
14054       }   14054       }
14055       matchbits = (uint8 )((int )maskbits << ((8U - src_bit) - (uint32 )bps));   14055       matchbits = (uint8 )((int )maskbits << ((8U - src_bit) - (uint32 )bps));
14056       buff1 = (uint8 )(((int )*next & (int )matchbits) << src_bit);   14056       buff1 = (uint8 )(((int )*next & (int )matchbits) << src_bit);
14057       if (ready_bits >= 8) {   14057       if (ready_bits >= 8) {
14058         tmp = dst;   14058         tmp = dst;
14059         dst ++;   14059         dst ++;
14060         *tmp = buff2;   14060         *tmp = buff2;
14061         buff2 = buff1;   14061         buff2 = buff1;
14062         ready_bits -= 8;   14062         ready_bits -= 8;
14063       } else {   14063       } else {
14064         buff2 = (uint8 )((int )buff2 | ((int )buff1 >> ready_bits));   14064         buff2 = (uint8 )((int )buff2 | ((int )buff1 >> ready_bits));
14065       }   14065       }
14066       ready_bits += (int )bps;   14066       ready_bits += (int )bps;
14067       sample = (tsample_t )((int )sample + 1);   14067       sample = (tsample_t )((int )sample + 1);
14068     }   14068     }
14069     row ++;   14069     row ++;
14070   }   14070   }
14071   if (ready_bits > 0) {   14071   if (ready_bits > 0) {
14072     buff1 = (uint8 )((unsigned int )buff2 & (255U << (8 - ready_bits)));   14072     buff1 = (uint8 )((unsigned int )buff2 & (255U << (8 - ready_bits)));
14073     tmp___0 = dst;   14073     tmp___0 = dst;
14074     dst ++;   14074     dst ++;
14075     *tmp___0 = buff1;   14075     *tmp___0 = buff1;
14076   } else {   14076   } else {
14077     14077  
14078   }   14078   }
14079   return (0);   14079   return (0);
14080 }   14080 }
14081 }   14081 }
14082 static int rotateContigSamples16bits(uint16 rotation , uint16 spp , uint16 bps ,   14082 static int rotateContigSamples16bits(uint16 rotation , uint16 spp , uint16 bps ,
14083                                      uint32 width , uint32 length , uint32 col ,   14083                                      uint32 width , uint32 length , uint32 col ,
14084                                      uint8 *src , uint8 *dst )   14084                                      uint8 *src , uint8 *dst )
14085 {   14085 {
14086   int ready_bits ;   14086   int ready_bits ;
14087   uint32 row ;   14087   uint32 row ;
14088   uint32 rowsize ;   14088   uint32 rowsize ;
14089   uint32 bit_offset ;   14089   uint32 bit_offset ;
14090   uint32 src_byte ;   14090   uint32 src_byte ;
14091   uint32 src_bit ;   14091   uint32 src_bit ;
14092   uint16 matchbits ;   14092   uint16 matchbits ;
14093   uint16 maskbits ;   14093   uint16 maskbits ;
14094   uint16 buff1 ;   14094   uint16 buff1 ;
14095   uint16 buff2 ;   14095   uint16 buff2 ;
14096   uint8 bytebuff ;   14096   uint8 bytebuff ;
14097   uint8 swapbuff[2] ;   14097   uint8 swapbuff[2] ;
14098   uint8 *next ;   14098   uint8 *next ;
14099   tsample_t sample ;   14099   tsample_t sample ;
14100   uint8 *tmp ;   14100   uint8 *tmp ;
14101   uint8 *tmp___0 ;   14101   uint8 *tmp___0 ;
14102     14102  
14103   {   14103   {
14104   ready_bits = 0;   14104   ready_bits = 0;
14105   src_byte = (uint32 )0;   14105   src_byte = (uint32 )0;
14106   src_bit = (uint32 )0;   14106   src_bit = (uint32 )0;
14107   matchbits = (uint16 )0;   14107   matchbits = (uint16 )0;
14108   maskbits = (uint16 )0;   14108   maskbits = (uint16 )0;
14109   buff1 = (uint16 )0;   14109   buff1 = (uint16 )0;
14110   buff2 = (uint16 )0;   14110   buff2 = (uint16 )0;
14111   bytebuff = (uint8 )0;   14111   bytebuff = (uint8 )0;
14112   if ((unsigned int )src == (unsigned int )((void *)0)) {   14112   if ((unsigned int )src == (unsigned int )((void *)0)) {
14113     TIFFError("rotateContigSamples16bits", "Invalid src or destination buffer");   14113     TIFFError("rotateContigSamples16bits", "Invalid src or destination buffer");
14114     return (1);   14114     return (1);
14115   } else   14115   } else
14116   if ((unsigned int )dst == (unsigned int )((void *)0)) {   14116   if ((unsigned int )dst == (unsigned int )((void *)0)) {
14117     TIFFError("rotateContigSamples16bits", "Invalid src or destination buffer");   14117     TIFFError("rotateContigSamples16bits", "Invalid src or destination buffer");
14118     return (1);   14118     return (1);
14119   } else {   14119   } else {
14120     14120  
14121   }   14121   }
14122   rowsize = ((uint32 )((int )bps * (int )spp) * width + 7U) / 8U;   14122   rowsize = ((uint32 )((int )bps * (int )spp) * width + 7U) / 8U;
14123   ready_bits = 0;   14123   ready_bits = 0;
14124   maskbits = (uint16 )(65535 >> (16 - (int )bps));   14124   maskbits = (uint16 )(65535 >> (16 - (int )bps));
14125   buff2 = (uint16 )0;   14125   buff2 = (uint16 )0;
14126   buff1 = buff2;   14126   buff1 = buff2;
14127   row = (uint32 )0;   14127   row = (uint32 )0;
14128   while (row < length) {   14128   while (row < length) {
14129     bit_offset = (col * (uint32 )bps) * (uint32 )spp;   14129     bit_offset = (col * (uint32 )bps) * (uint32 )spp;
14130     sample = (tsample_t )0;   14130     sample = (tsample_t )0;
14131     while ((int )sample < (int )spp) {   14131     while ((int )sample < (int )spp) {
14132       if ((int )sample == 0) {   14132       if ((int )sample == 0) {
14133         src_byte = bit_offset / 8U;   14133         src_byte = bit_offset / 8U;
14134         src_bit = bit_offset % 8U;   14134         src_bit = bit_offset % 8U;
14135       } else {   14135       } else {
14136         src_byte = (bit_offset + (uint32 )((int )sample * (int )bps)) / 8U;   14136         src_byte = (bit_offset + (uint32 )((int )sample * (int )bps)) / 8U;
14137         src_bit = (bit_offset + (uint32 )((int )sample * (int )bps)) % 8U;   14137         src_bit = (bit_offset + (uint32 )((int )sample * (int )bps)) % 8U;
14138       }   14138       }
14139       switch ((int )rotation) {   14139       switch ((int )rotation) {
14140       case 90:   14140       case 90:
14141       next = (src + src_byte) - row * rowsize;   14141       next = (src + src_byte) - row * rowsize;
14142       break;   14142       break;
14143       case 270:   14143       case 270:
14144       next = (src + src_byte) + row * rowsize;   14144       next = (src + src_byte) + row * rowsize;
14145       break;   14145       break;
14146       default:   14146       default:
14147       TIFFError("rotateContigSamples8bits", "Invalid rotation %d",   14147       TIFFError("rotateContigSamples8bits", "Invalid rotation %d",
14148                 (int )rotation);   14148                 (int )rotation);
14149       return (1);   14149       return (1);
14150       }   14150       }
14151       matchbits = (uint16 )((int )maskbits << ((16U - src_bit) - (uint32 )bps));   14151       matchbits = (uint16 )((int )maskbits << ((16U - src_bit) - (uint32 )bps));
14152       if (little_endian) {   14152       if (little_endian) {
14153         swapbuff[1] = *next;   14153         swapbuff[1] = *next;
14154         swapbuff[0] = *(next + 1);   14154         swapbuff[0] = *(next + 1);
14155       } else {   14155       } else {
14156         swapbuff[0] = *next;   14156         swapbuff[0] = *next;
14157         swapbuff[1] = *(next + 1);   14157         swapbuff[1] = *(next + 1);
14158       }   14158       }
14159       buff1 = *((uint16 *)(swapbuff));   14159       buff1 = *((uint16 *)(swapbuff));
14160       buff1 = (uint16 )(((int )buff1 & (int )matchbits) << src_bit);   14160       buff1 = (uint16 )(((int )buff1 & (int )matchbits) << src_bit);
14161       if (ready_bits >= 8) {   14161       if (ready_bits >= 8) {
14162         bytebuff = (uint8 )((int )buff2 >> 8);   14162         bytebuff = (uint8 )((int )buff2 >> 8);
14163         tmp = dst;   14163         tmp = dst;
14164         dst ++;   14164         dst ++;
14165         *tmp = bytebuff;   14165         *tmp = bytebuff;
14166         ready_bits -= 8;   14166         ready_bits -= 8;
14167         buff2 = (uint16 )(((int )buff2 << 8) | ((int )buff1 >> ready_bits));   14167         buff2 = (uint16 )(((int )buff2 << 8) | ((int )buff1 >> ready_bits));
14168       } else {   14168       } else {
14169         bytebuff = (uint8 )0;   14169         bytebuff = (uint8 )0;
14170         buff2 = (uint16 )((int )buff2 | ((int )buff1 >> ready_bits));   14170         buff2 = (uint16 )((int )buff2 | ((int )buff1 >> ready_bits));
14171       }   14171       }
14172       ready_bits += (int )bps;   14172       ready_bits += (int )bps;
14173       sample = (tsample_t )((int )sample + 1);   14173       sample = (tsample_t )((int )sample + 1);
14174     }   14174     }
14175     row ++;   14175     row ++;
14176   }   14176   }
14177   if (ready_bits > 0) {   14177   if (ready_bits > 0) {
14178     bytebuff = (uint8 )((int )buff2 >> 8);   14178     bytebuff = (uint8 )((int )buff2 >> 8);
14179     tmp___0 = dst;   14179     tmp___0 = dst;
14180     dst ++;   14180     dst ++;
14181     *tmp___0 = bytebuff;   14181     *tmp___0 = bytebuff;
14182   } else {   14182   } else {
14183     14183  
14184   }   14184   }
14185   return (0);   14185   return (0);
14186 }   14186 }
14187 }   14187 }
14188 static int rotateContigSamples24bits(uint16 rotation , uint16 spp , uint16 bps ,   14188 static int rotateContigSamples24bits(uint16 rotation , uint16 spp , uint16 bps ,
14189                                      uint32 width , uint32 length , uint32 col ,   14189                                      uint32 width , uint32 length , uint32 col ,
14190                                      uint8 *src , uint8 *dst )   14190                                      uint8 *src , uint8 *dst )
14191 {   14191 {
14192   int ready_bits ;   14192   int ready_bits ;
14193   uint32 row ;   14193   uint32 row ;
14194   uint32 rowsize ;   14194   uint32 rowsize ;
14195   uint32 bit_offset ;   14195   uint32 bit_offset ;
14196   uint32 src_byte ;   14196   uint32 src_byte ;
14197   uint32 src_bit ;   14197   uint32 src_bit ;
14198   uint32 matchbits ;   14198   uint32 matchbits ;
14199   uint32 maskbits ;   14199   uint32 maskbits ;
14200   uint32 buff1 ;   14200   uint32 buff1 ;
14201   uint32 buff2 ;   14201   uint32 buff2 ;
14202   uint8 bytebuff1 ;   14202   uint8 bytebuff1 ;
14203   uint8 bytebuff2 ;   14203   uint8 bytebuff2 ;
14204   uint8 swapbuff[4] ;   14204   uint8 swapbuff[4] ;
14205   uint8 *next ;   14205   uint8 *next ;
14206   tsample_t sample ;   14206   tsample_t sample ;
14207   uint8 *tmp ;   14207   uint8 *tmp ;
14208   uint8 *tmp___0 ;   14208   uint8 *tmp___0 ;
14209   uint8 *tmp___1 ;   14209   uint8 *tmp___1 ;
14210     14210  
14211   {   14211   {
14212   ready_bits = 0;   14212   ready_bits = 0;
14213   src_byte = (uint32 )0;   14213   src_byte = (uint32 )0;
14214   src_bit = (uint32 )0;   14214   src_bit = (uint32 )0;
14215   matchbits = (uint32 )0;   14215   matchbits = (uint32 )0;
14216   maskbits = (uint32 )0;   14216   maskbits = (uint32 )0;
14217   buff1 = (uint32 )0;   14217   buff1 = (uint32 )0;
14218   buff2 = (uint32 )0;   14218   buff2 = (uint32 )0;
14219   bytebuff1 = (uint8 )0;   14219   bytebuff1 = (uint8 )0;
14220   bytebuff2 = (uint8 )0;   14220   bytebuff2 = (uint8 )0;
14221   if ((unsigned int )src == (unsigned int )((void *)0)) {   14221   if ((unsigned int )src == (unsigned int )((void *)0)) {
14222     TIFFError("rotateContigSamples24bits", "Invalid src or destination buffer");   14222     TIFFError("rotateContigSamples24bits", "Invalid src or destination buffer");
14223     return (1);   14223     return (1);
14224   } else   14224   } else
14225   if ((unsigned int )dst == (unsigned int )((void *)0)) {   14225   if ((unsigned int )dst == (unsigned int )((void *)0)) {
14226     TIFFError("rotateContigSamples24bits", "Invalid src or destination buffer");   14226     TIFFError("rotateContigSamples24bits", "Invalid src or destination buffer");
14227     return (1);   14227     return (1);
14228   } else {   14228   } else {
14229     14229  
14230   }   14230   }
14231   rowsize = ((uint32 )((int )bps * (int )spp) * width + 7U) / 8U;   14231   rowsize = ((uint32 )((int )bps * (int )spp) * width + 7U) / 8U;
14232   ready_bits = 0;   14232   ready_bits = 0;
14233   maskbits = 4294967295U >> (32 - (int )bps);   14233   maskbits = 4294967295U >> (32 - (int )bps);
14234   buff2 = (uint32 )0;   14234   buff2 = (uint32 )0;
14235   buff1 = buff2;   14235   buff1 = buff2;
14236   row = (uint32 )0;   14236   row = (uint32 )0;
14237   while (row < length) {   14237   while (row < length) {
14238     bit_offset = (col * (uint32 )bps) * (uint32 )spp;   14238     bit_offset = (col * (uint32 )bps) * (uint32 )spp;
14239     sample = (tsample_t )0;   14239     sample = (tsample_t )0;
14240     while ((int )sample < (int )spp) {   14240     while ((int )sample < (int )spp) {
14241       if ((int )sample == 0) {   14241       if ((int )sample == 0) {
14242         src_byte = bit_offset / 8U;   14242         src_byte = bit_offset / 8U;
14243         src_bit = bit_offset % 8U;   14243         src_bit = bit_offset % 8U;
14244       } else {   14244       } else {
14245         src_byte = (bit_offset + (uint32 )((int )sample * (int )bps)) / 8U;   14245         src_byte = (bit_offset + (uint32 )((int )sample * (int )bps)) / 8U;
14246         src_bit = (bit_offset + (uint32 )((int )sample * (int )bps)) % 8U;   14246         src_bit = (bit_offset + (uint32 )((int )sample * (int )bps)) % 8U;
14247       }   14247       }
14248       switch ((int )rotation) {   14248       switch ((int )rotation) {
14249       case 90:   14249       case 90:
14250       next = (src + src_byte) - row * rowsize;   14250       next = (src + src_byte) - row * rowsize;
14251       break;   14251       break;
14252       case 270:   14252       case 270:
14253       next = (src + src_byte) + row * rowsize;   14253       next = (src + src_byte) + row * rowsize;
14254       break;   14254       break;
14255       default:   14255       default:
14256       TIFFError("rotateContigSamples8bits", "Invalid rotation %d",   14256       TIFFError("rotateContigSamples8bits", "Invalid rotation %d",
14257                 (int )rotation);   14257                 (int )rotation);
14258       return (1);   14258       return (1);
14259       }   14259       }
14260       matchbits = maskbits << ((32U - src_bit) - (uint32 )bps);   14260       matchbits = maskbits << ((32U - src_bit) - (uint32 )bps);
14261       if (little_endian) {   14261       if (little_endian) {
14262         swapbuff[3] = *next;   14262         swapbuff[3] = *next;
14263         swapbuff[2] = *(next + 1);   14263         swapbuff[2] = *(next + 1);
14264         swapbuff[1] = *(next + 2);   14264         swapbuff[1] = *(next + 2);
14265         swapbuff[0] = *(next + 3);   14265         swapbuff[0] = *(next + 3);
14266       } else {   14266       } else {
14267         swapbuff[0] = *next;   14267         swapbuff[0] = *next;
14268         swapbuff[1] = *(next + 1);   14268         swapbuff[1] = *(next + 1);
14269         swapbuff[2] = *(next + 2);   14269         swapbuff[2] = *(next + 2);
14270         swapbuff[3] = *(next + 3);   14270         swapbuff[3] = *(next + 3);
14271       }   14271       }
14272       buff1 = *((uint32 *)(swapbuff));   14272       buff1 = *((uint32 *)(swapbuff));
14273       buff1 = (buff1 & matchbits) << src_bit;   14273       buff1 = (buff1 & matchbits) << src_bit;
14274       if (ready_bits >= 16) {   14274       if (ready_bits >= 16) {
14275         bytebuff1 = (uint8 )(buff2 >> 24);   14275         bytebuff1 = (uint8 )(buff2 >> 24);
14276         tmp = dst;   14276         tmp = dst;
14277         dst ++;   14277         dst ++;
14278         *tmp = bytebuff1;   14278         *tmp = bytebuff1;
14279         bytebuff2 = (uint8 )(buff2 >> 16);   14279         bytebuff2 = (uint8 )(buff2 >> 16);
14280         tmp___0 = dst;   14280         tmp___0 = dst;
14281         dst ++;   14281         dst ++;
14282         *tmp___0 = bytebuff2;   14282         *tmp___0 = bytebuff2;
14283         ready_bits -= 16;   14283         ready_bits -= 16;
14284         buff2 = (buff2 << 16) | (buff1 >> ready_bits);   14284         buff2 = (buff2 << 16) | (buff1 >> ready_bits);
14285       } else {   14285       } else {
14286         bytebuff2 = (uint8 )0;   14286         bytebuff2 = (uint8 )0;
14287         bytebuff1 = bytebuff2;   14287         bytebuff1 = bytebuff2;
14288         buff2 |= buff1 >> ready_bits;   14288         buff2 |= buff1 >> ready_bits;
14289       }   14289       }
14290       ready_bits += (int )bps;   14290       ready_bits += (int )bps;
14291       sample = (tsample_t )((int )sample + 1);   14291       sample = (tsample_t )((int )sample + 1);
14292     }   14292     }
14293     row ++;   14293     row ++;
14294   }   14294   }
14295   while (ready_bits > 0) {   14295   while (ready_bits > 0) {
14296     bytebuff1 = (uint8 )(buff2 >> 24);   14296     bytebuff1 = (uint8 )(buff2 >> 24);
14297     tmp___1 = dst;   14297     tmp___1 = dst;
14298     dst ++;   14298     dst ++;
14299     *tmp___1 = bytebuff1;   14299     *tmp___1 = bytebuff1;
14300     buff2 <<= 8;   14300     buff2 <<= 8;
14301     bytebuff2 = bytebuff1;   14301     bytebuff2 = bytebuff1;
14302     ready_bits -= 8;   14302     ready_bits -= 8;
14303   }   14303   }
14304   return (0);   14304   return (0);
14305 }   14305 }
14306 }   14306 }
14307 static int rotateContigSamples32bits(uint16 rotation , uint16 spp , uint16 bps ,   14307 static int rotateContigSamples32bits(uint16 rotation , uint16 spp , uint16 bps ,
14308                                      uint32 width , uint32 length , uint32 col ,   14308                                      uint32 width , uint32 length , uint32 col ,
14309                                      uint8 *src , uint8 *dst )   14309                                      uint8 *src , uint8 *dst )
14310 {   14310 {
14311   int ready_bits ;   14311   int ready_bits ;
14312   int shift_width ;   14312   int shift_width ;
14313   int bytes_per_sample ;   14313   int bytes_per_sample ;
14314   int bytes_per_pixel ;   14314   int bytes_per_pixel ;
14315   uint32 row ;   14315   uint32 row ;
14316   uint32 rowsize ;   14316   uint32 rowsize ;
14317   uint32 bit_offset ;   14317   uint32 bit_offset ;
14318   uint32 src_byte ;   14318   uint32 src_byte ;
14319   uint32 src_bit ;   14319   uint32 src_bit ;
14320   uint32 longbuff1 ;   14320   uint32 longbuff1 ;
14321   uint32 longbuff2 ;   14321   uint32 longbuff2 ;
14322   uint64 maskbits ;   14322   uint64 maskbits ;
14323   uint64 matchbits ;   14323   uint64 matchbits ;
14324   uint64 buff1 ;   14324   uint64 buff1 ;
14325   uint64 buff2 ;   14325   uint64 buff2 ;
14326   uint64 buff3 ;   14326   uint64 buff3 ;
14327   uint8 bytebuff1 ;   14327   uint8 bytebuff1 ;
14328   uint8 bytebuff2 ;   14328   uint8 bytebuff2 ;
14329   uint8 bytebuff3 ;   14329   uint8 bytebuff3 ;
14330   uint8 bytebuff4 ;   14330   uint8 bytebuff4 ;
14331   unsigned char swapbuff1[4] ;   14331   unsigned char swapbuff1[4] ;
14332   unsigned char swapbuff2[4] ;   14332   unsigned char swapbuff2[4] ;
14333   uint8 *next ;   14333   uint8 *next ;
14334   tsample_t sample ;   14334   tsample_t sample ;
14335   uint8 *tmp ;   14335   uint8 *tmp ;
14336   uint8 *tmp___0 ;   14336   uint8 *tmp___0 ;
14337   uint8 *tmp___1 ;   14337   uint8 *tmp___1 ;
14338   uint8 *tmp___2 ;   14338   uint8 *tmp___2 ;
14339   uint8 *tmp___3 ;   14339   uint8 *tmp___3 ;
14340     14340  
14341   {   14341   {
14342   ready_bits = 0;   14342   ready_bits = 0;
14343   shift_width = 0;   14343   shift_width = 0;
14344   longbuff1 = (uint32 )0;   14344   longbuff1 = (uint32 )0;
14345   longbuff2 = (uint32 )0;   14345   longbuff2 = (uint32 )0;
14346   maskbits = (uint64 )0;   14346   maskbits = (uint64 )0;
14347   matchbits = (uint64 )0;   14347   matchbits = (uint64 )0;
14348   buff1 = (uint64 )0;   14348   buff1 = (uint64 )0;
14349   buff2 = (uint64 )0;   14349   buff2 = (uint64 )0;
14350   buff3 = (uint64 )0;   14350   buff3 = (uint64 )0;
14351   bytebuff1 = (uint8 )0;   14351   bytebuff1 = (uint8 )0;
14352   bytebuff2 = (uint8 )0;   14352   bytebuff2 = (uint8 )0;
14353   bytebuff3 = (uint8 )0;   14353   bytebuff3 = (uint8 )0;
14354   bytebuff4 = (uint8 )0;   14354   bytebuff4 = (uint8 )0;
14355   if ((unsigned int )src == (unsigned int )((void *)0)) {   14355   if ((unsigned int )src == (unsigned int )((void *)0)) {
14356     TIFFError("rotateContigSamples24bits", "Invalid src or destination buffer");   14356     TIFFError("rotateContigSamples24bits", "Invalid src or destination buffer");
14357     return (1);   14357     return (1);
14358   } else   14358   } else
14359   if ((unsigned int )dst == (unsigned int )((void *)0)) {   14359   if ((unsigned int )dst == (unsigned int )((void *)0)) {
14360     TIFFError("rotateContigSamples24bits", "Invalid src or destination buffer");   14360     TIFFError("rotateContigSamples24bits", "Invalid src or destination buffer");
14361     return (1);   14361     return (1);
14362   } else {   14362   } else {
14363     14363  
14364   }   14364   }
14365   bytes_per_sample = ((int )bps + 7) / 8;   14365   bytes_per_sample = ((int )bps + 7) / 8;
14366   bytes_per_pixel = ((int )bps * (int )spp + 7) / 8;   14366   bytes_per_pixel = ((int )bps * (int )spp + 7) / 8;
14367   if (bytes_per_pixel < bytes_per_sample + 1) {   14367   if (bytes_per_pixel < bytes_per_sample + 1) {
14368     shift_width = bytes_per_pixel;   14368     shift_width = bytes_per_pixel;
14369   } else {   14369   } else {
14370     shift_width = bytes_per_sample + 1;   14370     shift_width = bytes_per_sample + 1;
14371   }   14371   }
14372   rowsize = ((uint32 )((int )bps * (int )spp) * width + 7U) / 8U;   14372   rowsize = ((uint32 )((int )bps * (int )spp) * width + 7U) / 8U;
14373   ready_bits = 0;   14373   ready_bits = 0;
14374   maskbits = 0xffffffffffffffffULL >> (64 - (int )bps);   14374   maskbits = 0xffffffffffffffffULL >> (64 - (int )bps);
14375   buff2 = (uint64 )0;   14375   buff2 = (uint64 )0;
14376   buff1 = buff2;   14376   buff1 = buff2;
14377   row = (uint32 )0;   14377   row = (uint32 )0;
14378   while (row < length) {   14378   while (row < length) {
14379     bit_offset = (col * (uint32 )bps) * (uint32 )spp;   14379     bit_offset = (col * (uint32 )bps) * (uint32 )spp;
14380     sample = (tsample_t )0;   14380     sample = (tsample_t )0;
14381     while ((int )sample < (int )spp) {   14381     while ((int )sample < (int )spp) {
14382       if ((int )sample == 0) {   14382       if ((int )sample == 0) {
14383         src_byte = bit_offset / 8U;   14383         src_byte = bit_offset / 8U;
14384         src_bit = bit_offset % 8U;   14384         src_bit = bit_offset % 8U;
14385       } else {   14385       } else {
14386         src_byte = (bit_offset + (uint32 )((int )sample * (int )bps)) / 8U;   14386         src_byte = (bit_offset + (uint32 )((int )sample * (int )bps)) / 8U;
14387         src_bit = (bit_offset + (uint32 )((int )sample * (int )bps)) % 8U;   14387         src_bit = (bit_offset + (uint32 )((int )sample * (int )bps)) % 8U;
14388       }   14388       }
14389       switch ((int )rotation) {   14389       switch ((int )rotation) {
14390       case 90:   14390       case 90:
14391       next = (src + src_byte) - row * rowsize;   14391       next = (src + src_byte) - row * rowsize;
14392       break;   14392       break;
14393       case 270:   14393       case 270:
14394       next = (src + src_byte) + row * rowsize;   14394       next = (src + src_byte) + row * rowsize;
14395       break;   14395       break;
14396       default:   14396       default:
14397       TIFFError("rotateContigSamples8bits", "Invalid rotation %d",   14397       TIFFError("rotateContigSamples8bits", "Invalid rotation %d",
14398                 (int )rotation);   14398                 (int )rotation);
14399       return (1);   14399       return (1);
14400       }   14400       }
14401       matchbits = maskbits << ((64U - src_bit) - (uint32 )bps);   14401       matchbits = maskbits << ((64U - src_bit) - (uint32 )bps);
14402       if (little_endian) {   14402       if (little_endian) {
14403         swapbuff1[3] = *next;   14403         swapbuff1[3] = *next;
14404         swapbuff1[2] = *(next + 1);   14404         swapbuff1[2] = *(next + 1);
14405         swapbuff1[1] = *(next + 2);   14405         swapbuff1[1] = *(next + 2);
14406         swapbuff1[0] = *(next + 3);   14406         swapbuff1[0] = *(next + 3);
14407       } else {   14407       } else {
14408         swapbuff1[0] = *next;   14408         swapbuff1[0] = *next;
14409         swapbuff1[1] = *(next + 1);   14409         swapbuff1[1] = *(next + 1);
14410         swapbuff1[2] = *(next + 2);   14410         swapbuff1[2] = *(next + 2);
14411         swapbuff1[3] = *(next + 3);   14411         swapbuff1[3] = *(next + 3);
14412       }   14412       }
14413       longbuff1 = *((uint32 *)(swapbuff1));   14413       longbuff1 = *((uint32 *)(swapbuff1));
14414       memset((void *)(swapbuff2), '\000', sizeof(swapbuff2));   14414       memset((void *)(swapbuff2), '\000', sizeof(swapbuff2));
14415       if (little_endian) {   14415       if (little_endian) {
14416         swapbuff2[3] = *next;   14416         swapbuff2[3] = *next;
14417         swapbuff2[2] = *(next + 1);   14417         swapbuff2[2] = *(next + 1);
14418         swapbuff2[1] = *(next + 2);   14418         swapbuff2[1] = *(next + 2);
14419         swapbuff2[0] = *(next + 3);   14419         swapbuff2[0] = *(next + 3);
14420       } else {   14420       } else {
14421         swapbuff2[0] = *next;   14421         swapbuff2[0] = *next;
14422         swapbuff2[1] = *(next + 1);   14422         swapbuff2[1] = *(next + 1);
14423         swapbuff2[2] = *(next + 2);   14423         swapbuff2[2] = *(next + 2);
14424         swapbuff2[3] = *(next + 3);   14424         swapbuff2[3] = *(next + 3);
14425       }   14425       }
14426       longbuff2 = *((uint32 *)(swapbuff2));   14426       longbuff2 = *((uint32 *)(swapbuff2));
14427       buff3 = ((uint64 )longbuff1 << 32) | (unsigned long long )longbuff2;   14427       buff3 = ((uint64 )longbuff1 << 32) | (unsigned long long )longbuff2;
14428       buff1 = (buff3 & matchbits) << src_bit;   14428       buff1 = (buff3 & matchbits) << src_bit;
14429       if (ready_bits < 32) {   14429       if (ready_bits < 32) {
14430         bytebuff4 = (uint8 )0;   14430         bytebuff4 = (uint8 )0;
14431         bytebuff3 = bytebuff4;   14431         bytebuff3 = bytebuff4;
14432         bytebuff2 = bytebuff3;   14432         bytebuff2 = bytebuff3;
14433         bytebuff1 = bytebuff2;   14433         bytebuff1 = bytebuff2;
14434         buff2 |= buff1 >> ready_bits;   14434         buff2 |= buff1 >> ready_bits;
14435       } else {   14435       } else {
14436         bytebuff1 = (uint8 )(buff2 >> 56);   14436         bytebuff1 = (uint8 )(buff2 >> 56);
14437         tmp = dst;   14437         tmp = dst;
14438         dst ++;   14438         dst ++;
14439         *tmp = bytebuff1;   14439         *tmp = bytebuff1;
14440         bytebuff2 = (uint8 )(buff2 >> 48);   14440         bytebuff2 = (uint8 )(buff2 >> 48);
14441         tmp___0 = dst;   14441         tmp___0 = dst;
14442         dst ++;   14442         dst ++;
14443         *tmp___0 = bytebuff2;   14443         *tmp___0 = bytebuff2;
14444         bytebuff3 = (uint8 )(buff2 >> 40);   14444         bytebuff3 = (uint8 )(buff2 >> 40);
14445         tmp___1 = dst;   14445         tmp___1 = dst;
14446         dst ++;   14446         dst ++;
14447         *tmp___1 = bytebuff3;   14447         *tmp___1 = bytebuff3;
14448         bytebuff4 = (uint8 )(buff2 >> 32);   14448         bytebuff4 = (uint8 )(buff2 >> 32);
14449         tmp___2 = dst;   14449         tmp___2 = dst;
14450         dst ++;   14450         dst ++;
14451         *tmp___2 = bytebuff4;   14451         *tmp___2 = bytebuff4;
14452         ready_bits -= 32;   14452         ready_bits -= 32;
14453         buff2 = (buff2 << 32) | (buff1 >> ready_bits);   14453         buff2 = (buff2 << 32) | (buff1 >> ready_bits);
14454       }   14454       }
14455       ready_bits += (int )bps;   14455       ready_bits += (int )bps;
14456       sample = (tsample_t )((int )sample + 1);   14456       sample = (tsample_t )((int )sample + 1);
14457     }   14457     }
14458     row ++;   14458     row ++;
14459   }   14459   }
14460   while (ready_bits > 0) {   14460   while (ready_bits > 0) {
14461     bytebuff1 = (uint8 )(buff2 >> 56);   14461     bytebuff1 = (uint8 )(buff2 >> 56);
14462     tmp___3 = dst;   14462     tmp___3 = dst;
14463     dst ++;   14463     dst ++;
14464     *tmp___3 = bytebuff1;   14464     *tmp___3 = bytebuff1;
14465     buff2 <<= 8;   14465     buff2 <<= 8;
14466     ready_bits -= 8;   14466     ready_bits -= 8;
14467   }   14467   }
14468   return (0);   14468   return (0);
14469 }   14469 }
14470 }   14470 }
14471 static int rotateImage(uint16 rotation , struct image_data *image ,   14471 static int rotateImage(uint16 rotation , struct image_data *image ,
14472                        uint32 *img_width , uint32 *img_length ,   14472                        uint32 *img_width , uint32 *img_length ,
14473                        unsigned char **ibuff_ptr )   14473                        unsigned char **ibuff_ptr )
14474 {   14474 {
14475   int shift_width ;   14475   int shift_width ;
14476   uint32 bytes_per_pixel ;   14476   uint32 bytes_per_pixel ;
14477   uint32 bytes_per_sample ;   14477   uint32 bytes_per_sample ;
14478   uint32 row ;   14478   uint32 row ;
14479   uint32 rowsize ;   14479   uint32 rowsize ;
14480   uint32 src_offset ;   14480   uint32 src_offset ;
14481   uint32 dst_offset ;   14481   uint32 dst_offset ;
14482   uint32 i ;   14482   uint32 i ;
14483   uint32 col ;   14483   uint32 col ;
14484   uint32 width ;   14484   uint32 width ;
14485   uint32 length ;   14485   uint32 length ;
14486   uint32 colsize ;   14486   uint32 colsize ;
14487   uint32 buffsize ;   14487   uint32 buffsize ;
14488   uint32 col_offset ;   14488   uint32 col_offset ;
14489   uint32 pix_offset ;   14489   uint32 pix_offset ;
14490   unsigned char *ibuff ;   14490   unsigned char *ibuff ;
14491   unsigned char *src ;   14491   unsigned char *src ;
14492   unsigned char *dst ;   14492   unsigned char *dst ;
14493   uint16 spp ;   14493   uint16 spp ;
14494   uint16 bps ;   14494   uint16 bps ;
14495   float res_temp ;   14495   float res_temp ;
14496   unsigned char *rbuff ;   14496   unsigned char *rbuff ;
14497   void *tmp ;   14497   void *tmp ;
14498   unsigned char *tmp___0 ;   14498   unsigned char *tmp___0 ;
14499   unsigned char *tmp___1 ;   14499   unsigned char *tmp___1 ;
14500   int tmp___2 ;   14500   int tmp___2 ;
14501   int tmp___3 ;   14501   int tmp___3 ;
14502   int tmp___4 ;   14502   int tmp___4 ;
14503   int tmp___5 ;   14503   int tmp___5 ;
14504   unsigned char *tmp___6 ;   14504   unsigned char *tmp___6 ;
14505   int tmp___7 ;   14505   int tmp___7 ;
14506   int tmp___8 ;   14506   int tmp___8 ;
14507   int tmp___9 ;   14507   int tmp___9 ;
14508   int tmp___10 ;   14508   int tmp___10 ;
14509   unsigned char *tmp___11 ;   14509   unsigned char *tmp___11 ;
14510   int tmp___12 ;   14510   int tmp___12 ;
14511   int tmp___13 ;   14511   int tmp___13 ;
14512   int tmp___14 ;   14512   int tmp___14 ;
14513   int tmp___15 ;   14513   int tmp___15 ;
14514     14514  
14515   {   14515   {
14516   rbuff = (unsigned char *)((void *)0);   14516   rbuff = (unsigned char *)((void *)0);
14517   width = *img_width;   14517   width = *img_width;
14518   length = *img_length;   14518   length = *img_length;
14519   spp = image->spp;   14519   spp = image->spp;
14520   bps = image->bps;   14520   bps = image->bps;
14521   rowsize = ((uint32 )((int )bps * (int )spp) * width + 7U) / 8U;   14521   rowsize = ((uint32 )((int )bps * (int )spp) * width + 7U) / 8U;
14522   colsize = ((uint32 )((int )bps * (int )spp) * length + 7U) / 8U;   14522   colsize = ((uint32 )((int )bps * (int )spp) * length + 7U) / 8U;
14523   if (colsize * width > rowsize * length) {   14523   if (colsize * width > rowsize * length) {
14524     buffsize = (colsize + 1U) * width;   14524     buffsize = (colsize + 1U) * width;
14525   } else {   14525   } else {
14526     buffsize = (rowsize + 1U) * length;   14526     buffsize = (rowsize + 1U) * length;
14527   }   14527   }
14528   bytes_per_sample = (uint32 )(((int )bps + 7) / 8);   14528   bytes_per_sample = (uint32 )(((int )bps + 7) / 8);
14529   bytes_per_pixel = (uint32 )(((int )bps * (int )spp + 7) / 8);   14529   bytes_per_pixel = (uint32 )(((int )bps * (int )spp + 7) / 8);
14530   if (bytes_per_pixel < bytes_per_sample + 1U) {   14530   if (bytes_per_pixel < bytes_per_sample + 1U) {
14531     shift_width = (int )bytes_per_pixel;   14531     shift_width = (int )bytes_per_pixel;
14532   } else {   14532   } else {
14533     shift_width = (int )(bytes_per_sample + 1U);   14533     shift_width = (int )(bytes_per_sample + 1U);
14534   }   14534   }
14535   switch ((int )rotation) {   14535   switch ((int )rotation) {
14536   case 360:   14536   case 360:
14537   case 0:   14537   case 0:
14538   return (0);   14538   return (0);
14539   case 270:   14539   case 270:
14540   case 180:   14540   case 180:
14541   case 90:   14541   case 90:
14542   break;   14542   break;
14543   default:   14543   default:
14544   TIFFError("rotateImage", "Invalid rotation angle %d", (int )rotation);   14544   TIFFError("rotateImage", "Invalid rotation angle %d", (int )rotation);
14545   return (-1);   14545   return (-1);
14546   }   14546   }
14547   tmp = _TIFFmalloc((tmsize_t )buffsize);   14547   tmp = _TIFFmalloc((tmsize_t )buffsize);
14548   rbuff = (unsigned char *)tmp;   14548   rbuff = (unsigned char *)tmp;
14549   if (rbuff) {   14549   if (rbuff) {
14550     14550  
14551   } else {   14551   } else {
14552     TIFFError("rotateImage", "Unable to allocate rotation buffer of %1u bytes",   14552     TIFFError("rotateImage", "Unable to allocate rotation buffer of %1u bytes",
14553               buffsize);   14553               buffsize);
14554     return (-1);   14554     return (-1);
14555   }   14555   }
14556   _TIFFmemset((void *)rbuff, '\000', (tmsize_t )buffsize);   14556   _TIFFmemset((void *)rbuff, '\000', (tmsize_t )buffsize);
14557   ibuff = *ibuff_ptr;   14557   ibuff = *ibuff_ptr;
14558   switch ((int )rotation) {   14558   switch ((int )rotation) {
14559   case 180:   14559   case 180:
14560   if ((int )bps % 8 == 0) {   14560   if ((int )bps % 8 == 0) {
14561     src = ibuff;   14561     src = ibuff;
14562     pix_offset = (uint32 )(((int )spp * (int )bps) / 8);   14562     pix_offset = (uint32 )(((int )spp * (int )bps) / 8);
14563     row = (uint32 )0;   14563     row = (uint32 )0;
14564     while (row < length) {   14564     while (row < length) {
14565       dst_offset = ((length - row) - 1U) * rowsize;   14565       dst_offset = ((length - row) - 1U) * rowsize;
14566       col = (uint32 )0;   14566       col = (uint32 )0;
14567       while (col < width) {   14567       while (col < width) {
14568         col_offset = ((width - col) - 1U) * pix_offset;   14568         col_offset = ((width - col) - 1U) * pix_offset;
14569         dst = (rbuff + dst_offset) + col_offset;   14569         dst = (rbuff + dst_offset) + col_offset;
14570         i = (uint32 )0;   14570         i = (uint32 )0;
14571         while (i < bytes_per_pixel) {   14571         while (i < bytes_per_pixel) {
14572           tmp___0 = dst;   14572           tmp___0 = dst;
14573           dst ++;   14573           dst ++;
14574           tmp___1 = src;   14574           tmp___1 = src;
14575           src ++;   14575           src ++;
14576           *tmp___0 = *tmp___1;   14576           *tmp___0 = *tmp___1;
14577           i ++;   14577           i ++;
14578         }   14578         }
14579         col ++;   14579         col ++;
14580       }   14580       }
14581       row ++;   14581       row ++;
14582     }   14582     }
14583   } else {   14583   } else {
14584     row = (uint32 )0;   14584     row = (uint32 )0;
14585     while (row < length) {   14585     while (row < length) {
14586       src_offset = row * rowsize;   14586       src_offset = row * rowsize;
14587       dst_offset = ((length - row) - 1U) * rowsize;   14587       dst_offset = ((length - row) - 1U) * rowsize;
14588       src = ibuff + src_offset;   14588       src = ibuff + src_offset;
14589       dst = rbuff + dst_offset;   14589       dst = rbuff + dst_offset;
14590       switch (shift_width) {   14590       switch (shift_width) {
14591       case 1:   14591       case 1:
14592       tmp___2 = reverseSamples8bits(spp, bps, width, src, dst);   14592       tmp___2 = reverseSamples8bits(spp, bps, width, src, dst);
14593       if (tmp___2) {   14593       if (tmp___2) {
14594         _TIFFfree((void *)rbuff);   14594         _TIFFfree((void *)rbuff);
14595         return (-1);   14595         return (-1);
14596       } else {   14596       } else {
14597     14597  
14598       }   14598       }
14599       break;   14599       break;
14600       case 2:   14600       case 2:
14601       tmp___3 = reverseSamples16bits(spp, bps, width, src, dst);   14601       tmp___3 = reverseSamples16bits(spp, bps, width, src, dst);
14602       if (tmp___3) {   14602       if (tmp___3) {
14603         _TIFFfree((void *)rbuff);   14603         _TIFFfree((void *)rbuff);
14604         return (-1);   14604         return (-1);
14605       } else {   14605       } else {
14606     14606  
14607       }   14607       }
14608       break;   14608       break;
14609       case 3:   14609       case 3:
14610       tmp___4 = reverseSamples24bits(spp, bps, width, src, dst);   14610       tmp___4 = reverseSamples24bits(spp, bps, width, src, dst);
14611       if (tmp___4) {   14611       if (tmp___4) {
14612         _TIFFfree((void *)rbuff);   14612         _TIFFfree((void *)rbuff);
14613         return (-1);   14613         return (-1);
14614       } else {   14614       } else {
14615     14615  
14616       }   14616       }
14617       break;   14617       break;
14618       case 5:   14618       case 5:
14619       case 4:   14619       case 4:
14620       tmp___5 = reverseSamples32bits(spp, bps, width, src, dst);   14620       tmp___5 = reverseSamples32bits(spp, bps, width, src, dst);
14621       if (tmp___5) {   14621       if (tmp___5) {
14622         _TIFFfree((void *)rbuff);   14622         _TIFFfree((void *)rbuff);
14623         return (-1);   14623         return (-1);
14624       } else {   14624       } else {
14625     14625  
14626       }   14626       }
14627       break;   14627       break;
14628       default:   14628       default:
14629       TIFFError("rotateImage", "Unsupported bit depth %d", (int )bps);   14629       TIFFError("rotateImage", "Unsupported bit depth %d", (int )bps);
14630       _TIFFfree((void *)rbuff);   14630       _TIFFfree((void *)rbuff);
14631       return (-1);   14631       return (-1);
14632       }   14632       }
14633       row ++;   14633       row ++;
14634     }   14634     }
14635   }   14635   }
14636   _TIFFfree((void *)ibuff);   14636   _TIFFfree((void *)ibuff);
14637   *ibuff_ptr = rbuff;   14637   *ibuff_ptr = rbuff;
14638   break;   14638   break;
14639   case 90:   14639   case 90:
14640   if ((int )bps % 8 == 0) {   14640   if ((int )bps % 8 == 0) {
14641     col = (uint32 )0;   14641     col = (uint32 )0;
14642     while (col < width) {   14642     while (col < width) {
14643       src_offset = (length - 1U) * rowsize + col * bytes_per_pixel;   14643       src_offset = (length - 1U) * rowsize + col * bytes_per_pixel;
14644       dst_offset = col * colsize;   14644       dst_offset = col * colsize;
14645       src = ibuff + src_offset;   14645       src = ibuff + src_offset;
14646       dst = rbuff + dst_offset;   14646       dst = rbuff + dst_offset;
14647       row = length;   14647       row = length;
14648       while (row > 0U) {   14648       while (row > 0U) {
14649         i = (uint32 )0;   14649         i = (uint32 )0;
14650         while (i < bytes_per_pixel) {   14650         while (i < bytes_per_pixel) {
14651           tmp___6 = dst;   14651           tmp___6 = dst;
14652           dst ++;   14652           dst ++;
14653           *tmp___6 = *(src + i);   14653           *tmp___6 = *(src + i);
14654           i ++;   14654           i ++;
14655         }   14655         }
14656         src -= rowsize;   14656         src -= rowsize;
14657         row --;   14657         row --;
14658       }   14658       }
14659       col ++;   14659       col ++;
14660     }   14660     }
14661   } else {   14661   } else {
14662     col = (uint32 )0;   14662     col = (uint32 )0;
14663     while (col < width) {   14663     while (col < width) {
14664       src_offset = (length - 1U) * rowsize;   14664       src_offset = (length - 1U) * rowsize;
14665       dst_offset = col * colsize;   14665       dst_offset = col * colsize;
14666       src = ibuff + src_offset;   14666       src = ibuff + src_offset;
14667       dst = rbuff + dst_offset;   14667       dst = rbuff + dst_offset;
14668       switch (shift_width) {   14668       switch (shift_width) {
14669       case 1:   14669       case 1:
14670       tmp___7 = rotateContigSamples8bits(rotation, spp, bps, width, length, col,   14670       tmp___7 = rotateContigSamples8bits(rotation, spp, bps, width, length, col,
14671                                          src, dst);   14671                                          src, dst);
14672       if (tmp___7) {   14672       if (tmp___7) {
14673         _TIFFfree((void *)rbuff);   14673         _TIFFfree((void *)rbuff);
14674         return (-1);   14674         return (-1);
14675       } else {   14675       } else {
14676     14676  
14677       }   14677       }
14678       break;   14678       break;
14679       case 2:   14679       case 2:
14680       tmp___8 = rotateContigSamples16bits(rotation, spp, bps, width, length,   14680       tmp___8 = rotateContigSamples16bits(rotation, spp, bps, width, length,
14681                                           col, src, dst);   14681                                           col, src, dst);
14682       if (tmp___8) {   14682       if (tmp___8) {
14683         _TIFFfree((void *)rbuff);   14683         _TIFFfree((void *)rbuff);
14684         return (-1);   14684         return (-1);
14685       } else {   14685       } else {
14686     14686  
14687       }   14687       }
14688       break;   14688       break;
14689       case 3:   14689       case 3:
14690       tmp___9 = rotateContigSamples24bits(rotation, spp, bps, width, length,   14690       tmp___9 = rotateContigSamples24bits(rotation, spp, bps, width, length,
14691                                           col, src, dst);   14691                                           col, src, dst);
14692       if (tmp___9) {   14692       if (tmp___9) {
14693         _TIFFfree((void *)rbuff);   14693         _TIFFfree((void *)rbuff);
14694         return (-1);   14694         return (-1);
14695       } else {   14695       } else {
14696     14696  
14697       }   14697       }
14698       break;   14698       break;
14699       case 5:   14699       case 5:
14700       case 4:   14700       case 4:
14701       tmp___10 = rotateContigSamples32bits(rotation, spp, bps, width, length,   14701       tmp___10 = rotateContigSamples32bits(rotation, spp, bps, width, length,
14702                                            col, src, dst);   14702                                            col, src, dst);
14703       if (tmp___10) {   14703       if (tmp___10) {
14704         _TIFFfree((void *)rbuff);   14704         _TIFFfree((void *)rbuff);
14705         return (-1);   14705         return (-1);
14706       } else {   14706       } else {
14707     14707  
14708       }   14708       }
14709       break;   14709       break;
14710       default:   14710       default:
14711       TIFFError("rotateImage", "Unsupported bit depth %d", (int )bps);   14711       TIFFError("rotateImage", "Unsupported bit depth %d", (int )bps);
14712       _TIFFfree((void *)rbuff);   14712       _TIFFfree((void *)rbuff);
14713       return (-1);   14713       return (-1);
14714       }   14714       }
14715       col ++;   14715       col ++;
14716     }   14716     }
14717   }   14717   }
14718   _TIFFfree((void *)ibuff);   14718   _TIFFfree((void *)ibuff);
14719   *ibuff_ptr = rbuff;   14719   *ibuff_ptr = rbuff;
14720   *img_width = length;   14720   *img_width = length;
14721   *img_length = width;   14721   *img_length = width;
14722   image->width = length;   14722   image->width = length;
14723   image->length = width;   14723   image->length = width;
14724   res_temp = image->xres;   14724   res_temp = image->xres;
14725   image->xres = image->yres;   14725   image->xres = image->yres;
14726   image->yres = res_temp;   14726   image->yres = res_temp;
14727   break;   14727   break;
14728   case 270:   14728   case 270:
14729   if ((int )bps % 8 == 0) {   14729   if ((int )bps % 8 == 0) {
14730     col = (uint32 )0;   14730     col = (uint32 )0;
14731     while (col < width) {   14731     while (col < width) {
14732       src_offset = col * bytes_per_pixel;   14732       src_offset = col * bytes_per_pixel;
14733       dst_offset = ((width - col) - 1U) * colsize;   14733       dst_offset = ((width - col) - 1U) * colsize;
14734       src = ibuff + src_offset;   14734       src = ibuff + src_offset;
14735       dst = rbuff + dst_offset;   14735       dst = rbuff + dst_offset;
14736       row = length;   14736       row = length;
14737       while (row > 0U) {   14737       while (row > 0U) {
14738         i = (uint32 )0;   14738         i = (uint32 )0;
14739         while (i < bytes_per_pixel) {   14739         while (i < bytes_per_pixel) {
14740           tmp___11 = dst;   14740           tmp___11 = dst;
14741           dst ++;   14741           dst ++;
14742           *tmp___11 = *(src + i);   14742           *tmp___11 = *(src + i);
14743           i ++;   14743           i ++;
14744         }   14744         }
14745         src += rowsize;   14745         src += rowsize;
14746         row --;   14746         row --;
14747       }   14747       }
14748       col ++;   14748       col ++;
14749     }   14749     }
14750   } else {   14750   } else {
14751     col = (uint32 )0;   14751     col = (uint32 )0;
14752     while (col < width) {   14752     while (col < width) {
14753       src_offset = (uint32 )0;   14753       src_offset = (uint32 )0;
14754       dst_offset = ((width - col) - 1U) * colsize;   14754       dst_offset = ((width - col) - 1U) * colsize;
14755       src = ibuff + src_offset;   14755       src = ibuff + src_offset;
14756       dst = rbuff + dst_offset;   14756       dst = rbuff + dst_offset;
14757       switch (shift_width) {   14757       switch (shift_width) {
14758       case 1:   14758       case 1:
14759       tmp___12 = rotateContigSamples8bits(rotation, spp, bps, width, length,   14759       tmp___12 = rotateContigSamples8bits(rotation, spp, bps, width, length,
14760                                           col, src, dst);   14760                                           col, src, dst);
14761       if (tmp___12) {   14761       if (tmp___12) {
14762         _TIFFfree((void *)rbuff);   14762         _TIFFfree((void *)rbuff);
14763         return (-1);   14763         return (-1);
14764       } else {   14764       } else {
14765     14765  
14766       }   14766       }
14767       break;   14767       break;
14768       case 2:   14768       case 2:
14769       tmp___13 = rotateContigSamples16bits(rotation, spp, bps, width, length,   14769       tmp___13 = rotateContigSamples16bits(rotation, spp, bps, width, length,
14770                                            col, src, dst);   14770                                            col, src, dst);
14771       if (tmp___13) {   14771       if (tmp___13) {
14772         _TIFFfree((void *)rbuff);   14772         _TIFFfree((void *)rbuff);
14773         return (-1);   14773         return (-1);
14774       } else {   14774       } else {
14775     14775  
14776       }   14776       }
14777       break;   14777       break;
14778       case 3:   14778       case 3:
14779       tmp___14 = rotateContigSamples24bits(rotation, spp, bps, width, length,   14779       tmp___14 = rotateContigSamples24bits(rotation, spp, bps, width, length,
14780                                            col, src, dst);   14780                                            col, src, dst);
14781       if (tmp___14) {   14781       if (tmp___14) {
14782         _TIFFfree((void *)rbuff);   14782         _TIFFfree((void *)rbuff);
14783         return (-1);   14783         return (-1);
14784       } else {   14784       } else {
14785     14785  
14786       }   14786       }
14787       break;   14787       break;
14788       case 5:   14788       case 5:
14789       case 4:   14789       case 4:
14790       tmp___15 = rotateContigSamples32bits(rotation, spp, bps, width, length,   14790       tmp___15 = rotateContigSamples32bits(rotation, spp, bps, width, length,
14791                                            col, src, dst);   14791                                            col, src, dst);
14792       if (tmp___15) {   14792       if (tmp___15) {
14793         _TIFFfree((void *)rbuff);   14793         _TIFFfree((void *)rbuff);
14794         return (-1);   14794         return (-1);
14795       } else {   14795       } else {
14796     14796  
14797       }   14797       }
14798       break;   14798       break;
14799       default:   14799       default:
14800       TIFFError("rotateImage", "Unsupported bit depth %d", (int )bps);   14800       TIFFError("rotateImage", "Unsupported bit depth %d", (int )bps);
14801       _TIFFfree((void *)rbuff);   14801       _TIFFfree((void *)rbuff);
14802       return (-1);   14802       return (-1);
14803       }   14803       }
14804       col ++;   14804       col ++;
14805     }   14805     }
14806   }   14806   }
14807   _TIFFfree((void *)ibuff);   14807   _TIFFfree((void *)ibuff);
14808   *ibuff_ptr = rbuff;   14808   *ibuff_ptr = rbuff;
14809   *img_width = length;   14809   *img_width = length;
14810   *img_length = width;   14810   *img_length = width;
14811   image->width = length;   14811   image->width = length;
14812   image->length = width;   14812   image->length = width;
14813   res_temp = image->xres;   14813   res_temp = image->xres;
14814   image->xres = image->yres;   14814   image->xres = image->yres;
14815   image->yres = res_temp;   14815   image->yres = res_temp;
14816   break;   14816   break;
14817   default:   14817   default:
14818   break;   14818   break;
14819   }   14819   }
14820   return (0);   14820   return (0);
14821 }   14821 }
14822 }   14822 }
14823 static int reverseSamples8bits(uint16 spp , uint16 bps , uint32 width ,   14823 static int reverseSamples8bits(uint16 spp , uint16 bps , uint32 width ,
14824                                uint8 *ibuff , uint8 *obuff )   14824                                uint8 *ibuff , uint8 *obuff )
14825 {   14825 {
14826   int ready_bits ;   14826   int ready_bits ;
14827   uint32 col ;   14827   uint32 col ;
14828   uint32 src_byte ;   14828   uint32 src_byte ;
14829   uint32 src_bit ;   14829   uint32 src_bit ;
14830   uint32 bit_offset ;   14830   uint32 bit_offset ;
14831   uint8 matchbits ;   14831   uint8 matchbits ;
14832   uint8 maskbits ;   14832   uint8 maskbits ;
14833   uint8 buff1 ;   14833   uint8 buff1 ;
14834   uint8 buff2 ;   14834   uint8 buff2 ;
14835   unsigned char *src ;   14835   unsigned char *src ;
14836   unsigned char *dst ;   14836   unsigned char *dst ;
14837   tsample_t sample ;   14837   tsample_t sample ;
14838   unsigned char *tmp ;   14838   unsigned char *tmp ;
14839   unsigned char *tmp___0 ;   14839   unsigned char *tmp___0 ;
14840     14840  
14841   {   14841   {
14842   ready_bits = 0;   14842   ready_bits = 0;
14843   bit_offset = (uint32 )0;   14843   bit_offset = (uint32 )0;
14844   matchbits = (uint8 )0;   14844   matchbits = (uint8 )0;
14845   maskbits = (uint8 )0;   14845   maskbits = (uint8 )0;
14846   buff1 = (uint8 )0;   14846   buff1 = (uint8 )0;
14847   buff2 = (uint8 )0;   14847   buff2 = (uint8 )0;
14848   if ((unsigned int )ibuff == (unsigned int )((void *)0)) {   14848   if ((unsigned int )ibuff == (unsigned int )((void *)0)) {
14849     TIFFError("reverseSamples8bits", "Invalid image or work buffer");   14849     TIFFError("reverseSamples8bits", "Invalid image or work buffer");
14850     return (1);   14850     return (1);
14851   } else   14851   } else
14852   if ((unsigned int )obuff == (unsigned int )((void *)0)) {   14852   if ((unsigned int )obuff == (unsigned int )((void *)0)) {
14853     TIFFError("reverseSamples8bits", "Invalid image or work buffer");   14853     TIFFError("reverseSamples8bits", "Invalid image or work buffer");
14854     return (1);   14854     return (1);
14855   } else {   14855   } else {
14856     14856  
14857   }   14857   }
14858   ready_bits = 0;   14858   ready_bits = 0;
14859   maskbits = (uint8 )(255 >> (8 - (int )bps));   14859   maskbits = (uint8 )(255 >> (8 - (int )bps));
14860   dst = obuff;   14860   dst = obuff;
14861   col = width;   14861   col = width;
14862   while (col > 0U) {   14862   while (col > 0U) {
14863     bit_offset = ((col - 1U) * (uint32 )bps) * (uint32 )spp;   14863     bit_offset = ((col - 1U) * (uint32 )bps) * (uint32 )spp;
14864     sample = (tsample_t )0;   14864     sample = (tsample_t )0;
14865     while ((int )sample < (int )spp) {   14865     while ((int )sample < (int )spp) {
14866       if ((int )sample == 0) {   14866       if ((int )sample == 0) {
14867         src_byte = bit_offset / 8U;   14867         src_byte = bit_offset / 8U;
14868         src_bit = bit_offset % 8U;   14868         src_bit = bit_offset % 8U;
14869       } else {   14869       } else {
14870         src_byte = (bit_offset + (uint32 )((int )sample * (int )bps)) / 8U;   14870         src_byte = (bit_offset + (uint32 )((int )sample * (int )bps)) / 8U;
14871         src_bit = (bit_offset + (uint32 )((int )sample * (int )bps)) % 8U;   14871         src_bit = (bit_offset + (uint32 )((int )sample * (int )bps)) % 8U;
14872       }   14872       }
14873       src = ibuff + src_byte;   14873       src = ibuff + src_byte;
14874       matchbits = (uint8 )((int )maskbits << ((8U - src_bit) - (uint32 )bps));   14874       matchbits = (uint8 )((int )maskbits << ((8U - src_bit) - (uint32 )bps));
14875       buff1 = (uint8 )(((int )*src & (int )matchbits) << src_bit);   14875       buff1 = (uint8 )(((int )*src & (int )matchbits) << src_bit);
14876       if (ready_bits < 8) {   14876       if (ready_bits < 8) {
14877         buff2 = (uint8 )((int )buff2 | ((int )buff1 >> ready_bits));   14877         buff2 = (uint8 )((int )buff2 | ((int )buff1 >> ready_bits));
14878       } else {   14878       } else {
14879         tmp = dst;   14879         tmp = dst;
14880         dst ++;   14880         dst ++;
14881         *tmp = buff2;   14881         *tmp = buff2;
14882         buff2 = buff1;   14882         buff2 = buff1;
14883         ready_bits -= 8;   14883         ready_bits -= 8;
14884       }   14884       }
14885       ready_bits += (int )bps;   14885       ready_bits += (int )bps;
14886       sample = (tsample_t )((int )sample + 1);   14886       sample = (tsample_t )((int )sample + 1);
14887     }   14887     }
14888     col --;   14888     col --;
14889   }   14889   }
14890   if (ready_bits > 0) {   14890   if (ready_bits > 0) {
14891     buff1 = (uint8 )((unsigned int )buff2 & (255U << (8 - ready_bits)));   14891     buff1 = (uint8 )((unsigned int )buff2 & (255U << (8 - ready_bits)));
14892     tmp___0 = dst;   14892     tmp___0 = dst;
14893     dst ++;   14893     dst ++;
14894     *tmp___0 = buff1;   14894     *tmp___0 = buff1;
14895   } else {   14895   } else {
14896     14896  
14897   }   14897   }
14898   return (0);   14898   return (0);
14899 }   14899 }
14900 }   14900 }
14901 static int reverseSamples16bits(uint16 spp , uint16 bps , uint32 width ,   14901 static int reverseSamples16bits(uint16 spp , uint16 bps , uint32 width ,
14902                                 uint8 *ibuff , uint8 *obuff )   14902                                 uint8 *ibuff , uint8 *obuff )
14903 {   14903 {
14904   int ready_bits ;   14904   int ready_bits ;
14905   uint32 col ;   14905   uint32 col ;
14906   uint32 src_byte ;   14906   uint32 src_byte ;
14907   uint32 src_bit ;   14907   uint32 src_bit ;
14908   uint32 bit_offset ;   14908   uint32 bit_offset ;
14909   uint16 matchbits ;   14909   uint16 matchbits ;
14910   uint16 maskbits ;   14910   uint16 maskbits ;
14911   uint16 buff1 ;   14911   uint16 buff1 ;
14912   uint16 buff2 ;   14912   uint16 buff2 ;
14913   uint8 bytebuff ;   14913   uint8 bytebuff ;
14914   unsigned char *src ;   14914   unsigned char *src ;
14915   unsigned char *dst ;   14915   unsigned char *dst ;
14916   unsigned char swapbuff[2] ;   14916   unsigned char swapbuff[2] ;
14917   tsample_t sample ;   14917   tsample_t sample ;
14918   unsigned char *tmp ;   14918   unsigned char *tmp ;
14919   unsigned char *tmp___0 ;   14919   unsigned char *tmp___0 ;
14920     14920  
14921   {   14921   {
14922   ready_bits = 0;   14922   ready_bits = 0;
14923   src_byte = (uint32 )0;   14923   src_byte = (uint32 )0;
14924   src_bit = (uint32 )0;   14924   src_bit = (uint32 )0;
14925   bit_offset = (uint32 )0;   14925   bit_offset = (uint32 )0;
14926   matchbits = (uint16 )0;   14926   matchbits = (uint16 )0;
14927   maskbits = (uint16 )0;   14927   maskbits = (uint16 )0;
14928   buff1 = (uint16 )0;   14928   buff1 = (uint16 )0;
14929   buff2 = (uint16 )0;   14929   buff2 = (uint16 )0;
14930   bytebuff = (uint8 )0;   14930   bytebuff = (uint8 )0;
14931   if ((unsigned int )ibuff == (unsigned int )((void *)0)) {   14931   if ((unsigned int )ibuff == (unsigned int )((void *)0)) {
14932     TIFFError("reverseSample16bits", "Invalid image or work buffer");   14932     TIFFError("reverseSample16bits", "Invalid image or work buffer");
14933     return (1);   14933     return (1);
14934   } else   14934   } else
14935   if ((unsigned int )obuff == (unsigned int )((void *)0)) {   14935   if ((unsigned int )obuff == (unsigned int )((void *)0)) {
14936     TIFFError("reverseSample16bits", "Invalid image or work buffer");   14936     TIFFError("reverseSample16bits", "Invalid image or work buffer");
14937     return (1);   14937     return (1);
14938   } else {   14938   } else {
14939     14939  
14940   }   14940   }
14941   ready_bits = 0;   14941   ready_bits = 0;
14942   maskbits = (uint16 )(65535 >> (16 - (int )bps));   14942   maskbits = (uint16 )(65535 >> (16 - (int )bps));
14943   dst = obuff;   14943   dst = obuff;
14944   col = width;   14944   col = width;
14945   while (col > 0U) {   14945   while (col > 0U) {
14946     bit_offset = ((col - 1U) * (uint32 )bps) * (uint32 )spp;   14946     bit_offset = ((col - 1U) * (uint32 )bps) * (uint32 )spp;
14947     sample = (tsample_t )0;   14947     sample = (tsample_t )0;
14948     while ((int )sample < (int )spp) {   14948     while ((int )sample < (int )spp) {
14949       if ((int )sample == 0) {   14949       if ((int )sample == 0) {
14950         src_byte = bit_offset / 8U;   14950         src_byte = bit_offset / 8U;
14951         src_bit = bit_offset % 8U;   14951         src_bit = bit_offset % 8U;
14952       } else {   14952       } else {
14953         src_byte = (bit_offset + (uint32 )((int )sample * (int )bps)) / 8U;   14953         src_byte = (bit_offset + (uint32 )((int )sample * (int )bps)) / 8U;
14954         src_bit = (bit_offset + (uint32 )((int )sample * (int )bps)) % 8U;   14954         src_bit = (bit_offset + (uint32 )((int )sample * (int )bps)) % 8U;
14955       }   14955       }
14956       src = ibuff + src_byte;   14956       src = ibuff + src_byte;
14957       matchbits = (uint16 )((int )maskbits << ((16U - src_bit) - (uint32 )bps));   14957       matchbits = (uint16 )((int )maskbits << ((16U - src_bit) - (uint32 )bps));
14958       if (little_endian) {   14958       if (little_endian) {
14959         swapbuff[1] = *src;   14959         swapbuff[1] = *src;
14960         swapbuff[0] = *(src + 1);   14960         swapbuff[0] = *(src + 1);
14961       } else {   14961       } else {
14962         swapbuff[0] = *src;   14962         swapbuff[0] = *src;
14963         swapbuff[1] = *(src + 1);   14963         swapbuff[1] = *(src + 1);
14964       }   14964       }
14965       buff1 = *((uint16 *)(swapbuff));   14965       buff1 = *((uint16 *)(swapbuff));
14966       buff1 = (uint16 )(((int )buff1 & (int )matchbits) << src_bit);   14966       buff1 = (uint16 )(((int )buff1 & (int )matchbits) << src_bit);
14967       if (ready_bits < 8) {   14967       if (ready_bits < 8) {
14968         bytebuff = (uint8 )0;   14968         bytebuff = (uint8 )0;
14969         buff2 = (uint16 )((int )buff2 | ((int )buff1 >> ready_bits));   14969         buff2 = (uint16 )((int )buff2 | ((int )buff1 >> ready_bits));
14970       } else {   14970       } else {
14971         bytebuff = (uint8 )((int )buff2 >> 8);   14971         bytebuff = (uint8 )((int )buff2 >> 8);
14972         tmp = dst;   14972         tmp = dst;
14973         dst ++;   14973         dst ++;
14974         *tmp = bytebuff;   14974         *tmp = bytebuff;
14975         ready_bits -= 8;   14975         ready_bits -= 8;
14976         buff2 = (uint16 )(((int )buff2 << 8) | ((int )buff1 >> ready_bits));   14976         buff2 = (uint16 )(((int )buff2 << 8) | ((int )buff1 >> ready_bits));
14977       }   14977       }
14978       ready_bits += (int )bps;   14978       ready_bits += (int )bps;
14979       sample = (tsample_t )((int )sample + 1);   14979       sample = (tsample_t )((int )sample + 1);
14980     }   14980     }
14981     col --;   14981     col --;
14982   }   14982   }
14983   if (ready_bits > 0) {   14983   if (ready_bits > 0) {
14984     bytebuff = (uint8 )((int )buff2 >> 8);   14984     bytebuff = (uint8 )((int )buff2 >> 8);
14985     tmp___0 = dst;   14985     tmp___0 = dst;
14986     dst ++;   14986     dst ++;
14987     *tmp___0 = bytebuff;   14987     *tmp___0 = bytebuff;
14988   } else {   14988   } else {
14989     14989  
14990   }   14990   }
14991   return (0);   14991   return (0);
14992 }   14992 }
14993 }   14993 }
14994 static int reverseSamples24bits(uint16 spp , uint16 bps , uint32 width ,   14994 static int reverseSamples24bits(uint16 spp , uint16 bps , uint32 width ,
14995                                 uint8 *ibuff , uint8 *obuff )   14995                                 uint8 *ibuff , uint8 *obuff )
14996 {   14996 {
14997   int ready_bits ;   14997   int ready_bits ;
14998   uint32 col ;   14998   uint32 col ;
14999   uint32 src_byte ;   14999   uint32 src_byte ;
15000   uint32 src_bit ;   15000   uint32 src_bit ;
15001   uint32 bit_offset ;   15001   uint32 bit_offset ;
15002   uint32 matchbits ;   15002   uint32 matchbits ;
15003   uint32 maskbits ;   15003   uint32 maskbits ;
15004   uint32 buff1 ;   15004   uint32 buff1 ;
15005   uint32 buff2 ;   15005   uint32 buff2 ;
15006   uint8 bytebuff1 ;   15006   uint8 bytebuff1 ;
15007   uint8 bytebuff2 ;   15007   uint8 bytebuff2 ;
15008   unsigned char *src ;   15008   unsigned char *src ;
15009   unsigned char *dst ;   15009   unsigned char *dst ;
15010   unsigned char swapbuff[4] ;   15010   unsigned char swapbuff[4] ;
15011   tsample_t sample ;   15011   tsample_t sample ;
15012   unsigned char *tmp ;   15012   unsigned char *tmp ;
15013   unsigned char *tmp___0 ;   15013   unsigned char *tmp___0 ;
15014   unsigned char *tmp___1 ;   15014   unsigned char *tmp___1 ;
15015     15015  
15016   {   15016   {
15017   ready_bits = 0;   15017   ready_bits = 0;
15018   src_byte = (uint32 )0;   15018   src_byte = (uint32 )0;
15019   src_bit = (uint32 )0;   15019   src_bit = (uint32 )0;
15020   bit_offset = (uint32 )0;   15020   bit_offset = (uint32 )0;
15021   matchbits = (uint32 )0;   15021   matchbits = (uint32 )0;
15022   maskbits = (uint32 )0;   15022   maskbits = (uint32 )0;
15023   buff1 = (uint32 )0;   15023   buff1 = (uint32 )0;
15024   buff2 = (uint32 )0;   15024   buff2 = (uint32 )0;
15025   bytebuff1 = (uint8 )0;   15025   bytebuff1 = (uint8 )0;
15026   bytebuff2 = (uint8 )0;   15026   bytebuff2 = (uint8 )0;
15027   if ((unsigned int )ibuff == (unsigned int )((void *)0)) {   15027   if ((unsigned int )ibuff == (unsigned int )((void *)0)) {
15028     TIFFError("reverseSamples24bits", "Invalid image or work buffer");   15028     TIFFError("reverseSamples24bits", "Invalid image or work buffer");
15029     return (1);   15029     return (1);
15030   } else   15030   } else
15031   if ((unsigned int )obuff == (unsigned int )((void *)0)) {   15031   if ((unsigned int )obuff == (unsigned int )((void *)0)) {
15032     TIFFError("reverseSamples24bits", "Invalid image or work buffer");   15032     TIFFError("reverseSamples24bits", "Invalid image or work buffer");
15033     return (1);   15033     return (1);
15034   } else {   15034   } else {
15035     15035  
15036   }   15036   }
15037   ready_bits = 0;   15037   ready_bits = 0;
15038   maskbits = 4294967295U >> (32 - (int )bps);   15038   maskbits = 4294967295U >> (32 - (int )bps);
15039   dst = obuff;   15039   dst = obuff;
15040   col = width;   15040   col = width;
15041   while (col > 0U) {   15041   while (col > 0U) {
15042     bit_offset = ((col - 1U) * (uint32 )bps) * (uint32 )spp;   15042     bit_offset = ((col - 1U) * (uint32 )bps) * (uint32 )spp;
15043     sample = (tsample_t )0;   15043     sample = (tsample_t )0;
15044     while ((int )sample < (int )spp) {   15044     while ((int )sample < (int )spp) {
15045       if ((int )sample == 0) {   15045       if ((int )sample == 0) {
15046         src_byte = bit_offset / 8U;   15046         src_byte = bit_offset / 8U;
15047         src_bit = bit_offset % 8U;   15047         src_bit = bit_offset % 8U;
15048       } else {   15048       } else {
15049         src_byte = (bit_offset + (uint32 )((int )sample * (int )bps)) / 8U;   15049         src_byte = (bit_offset + (uint32 )((int )sample * (int )bps)) / 8U;
15050         src_bit = (bit_offset + (uint32 )((int )sample * (int )bps)) % 8U;   15050         src_bit = (bit_offset + (uint32 )((int )sample * (int )bps)) % 8U;
15051       }   15051       }
15052       src = ibuff + src_byte;   15052       src = ibuff + src_byte;
15053       matchbits = maskbits << ((32U - src_bit) - (uint32 )bps);   15053       matchbits = maskbits << ((32U - src_bit) - (uint32 )bps);
15054       if (little_endian) {   15054       if (little_endian) {
15055         swapbuff[3] = *src;   15055         swapbuff[3] = *src;
15056         swapbuff[2] = *(src + 1);   15056         swapbuff[2] = *(src + 1);
15057         swapbuff[1] = *(src + 2);   15057         swapbuff[1] = *(src + 2);
15058         swapbuff[0] = *(src + 3);   15058         swapbuff[0] = *(src + 3);
15059       } else {   15059       } else {
15060         swapbuff[0] = *src;   15060         swapbuff[0] = *src;
15061         swapbuff[1] = *(src + 1);   15061         swapbuff[1] = *(src + 1);
15062         swapbuff[2] = *(src + 2);   15062         swapbuff[2] = *(src + 2);
15063         swapbuff[3] = *(src + 3);   15063         swapbuff[3] = *(src + 3);
15064       }   15064       }
15065       buff1 = *((uint32 *)(swapbuff));   15065       buff1 = *((uint32 *)(swapbuff));
15066       buff1 = (buff1 & matchbits) << src_bit;   15066       buff1 = (buff1 & matchbits) << src_bit;
15067       if (ready_bits < 16) {   15067       if (ready_bits < 16) {
15068         bytebuff2 = (uint8 )0;   15068         bytebuff2 = (uint8 )0;
15069         bytebuff1 = bytebuff2;   15069         bytebuff1 = bytebuff2;
15070         buff2 |= buff1 >> ready_bits;   15070         buff2 |= buff1 >> ready_bits;
15071       } else {   15071       } else {
15072         bytebuff1 = (uint8 )(buff2 >> 24);   15072         bytebuff1 = (uint8 )(buff2 >> 24);
15073         tmp = dst;   15073         tmp = dst;
15074         dst ++;   15074         dst ++;
15075         *tmp = bytebuff1;   15075         *tmp = bytebuff1;
15076         bytebuff2 = (uint8 )(buff2 >> 16);   15076         bytebuff2 = (uint8 )(buff2 >> 16);
15077         tmp___0 = dst;   15077         tmp___0 = dst;
15078         dst ++;   15078         dst ++;
15079         *tmp___0 = bytebuff2;   15079         *tmp___0 = bytebuff2;
15080         ready_bits -= 16;   15080         ready_bits -= 16;
15081         buff2 = (buff2 << 16) | (buff1 >> ready_bits);   15081         buff2 = (buff2 << 16) | (buff1 >> ready_bits);
15082       }   15082       }
15083       ready_bits += (int )bps;   15083       ready_bits += (int )bps;
15084       sample = (tsample_t )((int )sample + 1);   15084       sample = (tsample_t )((int )sample + 1);
15085     }   15085     }
15086     col --;   15086     col --;
15087   }   15087   }
15088   while (ready_bits > 0) {   15088   while (ready_bits > 0) {
15089     bytebuff1 = (uint8 )(buff2 >> 24);   15089     bytebuff1 = (uint8 )(buff2 >> 24);
15090     tmp___1 = dst;   15090     tmp___1 = dst;
15091     dst ++;   15091     dst ++;
15092     *tmp___1 = bytebuff1;   15092     *tmp___1 = bytebuff1;
15093     buff2 <<= 8;   15093     buff2 <<= 8;
15094     bytebuff2 = bytebuff1;   15094     bytebuff2 = bytebuff1;
15095     ready_bits -= 8;   15095     ready_bits -= 8;
15096   }   15096   }
15097   return (0);   15097   return (0);
15098 }   15098 }
15099 }   15099 }
15100 static int reverseSamples32bits(uint16 spp , uint16 bps , uint32 width ,   15100 static int reverseSamples32bits(uint16 spp , uint16 bps , uint32 width ,
15101                                 uint8 *ibuff , uint8 *obuff )   15101                                 uint8 *ibuff , uint8 *obuff )
15102 {   15102 {
15103   int ready_bits ;   15103   int ready_bits ;
15104   int shift_width ;   15104   int shift_width ;
15105   int bytes_per_sample ;   15105   int bytes_per_sample ;
15106   int bytes_per_pixel ;   15106   int bytes_per_pixel ;
15107   uint32 bit_offset ;   15107   uint32 bit_offset ;
15108   uint32 src_byte ;   15108   uint32 src_byte ;
15109   uint32 src_bit ;   15109   uint32 src_bit ;
15110   uint32 col ;   15110   uint32 col ;
15111   uint32 longbuff1 ;   15111   uint32 longbuff1 ;
15112   uint32 longbuff2 ;   15112   uint32 longbuff2 ;
15113   uint64 maskbits ;   15113   uint64 maskbits ;
15114   uint64 matchbits ;   15114   uint64 matchbits ;
15115   uint64 buff1 ;   15115   uint64 buff1 ;
15116   uint64 buff2 ;   15116   uint64 buff2 ;
15117   uint64 buff3 ;   15117   uint64 buff3 ;
15118   uint8 bytebuff1 ;   15118   uint8 bytebuff1 ;
15119   uint8 bytebuff2 ;   15119   uint8 bytebuff2 ;
15120   uint8 bytebuff3 ;   15120   uint8 bytebuff3 ;
15121   uint8 bytebuff4 ;   15121   uint8 bytebuff4 ;
15122   unsigned char *src ;   15122   unsigned char *src ;
15123   unsigned char *dst ;   15123   unsigned char *dst ;
15124   unsigned char swapbuff1[4] ;   15124   unsigned char swapbuff1[4] ;
15125   unsigned char swapbuff2[4] ;   15125   unsigned char swapbuff2[4] ;
15126   tsample_t sample ;   15126   tsample_t sample ;
15127   unsigned char *tmp ;   15127   unsigned char *tmp ;
15128   unsigned char *tmp___0 ;   15128   unsigned char *tmp___0 ;
15129   unsigned char *tmp___1 ;   15129   unsigned char *tmp___1 ;
15130   unsigned char *tmp___2 ;   15130   unsigned char *tmp___2 ;
15131   unsigned char *tmp___3 ;   15131   unsigned char *tmp___3 ;
15132     15132  
15133   {   15133   {
15134   ready_bits = 0;   15134   ready_bits = 0;
15135   shift_width = 0;   15135   shift_width = 0;
15136   src_byte = (uint32 )0;   15136   src_byte = (uint32 )0;
15137   src_bit = (uint32 )0;   15137   src_bit = (uint32 )0;
15138   longbuff1 = (uint32 )0;   15138   longbuff1 = (uint32 )0;
15139   longbuff2 = (uint32 )0;   15139   longbuff2 = (uint32 )0;
15140   maskbits = (uint64 )0;   15140   maskbits = (uint64 )0;
15141   matchbits = (uint64 )0;   15141   matchbits = (uint64 )0;
15142   buff1 = (uint64 )0;   15142   buff1 = (uint64 )0;
15143   buff2 = (uint64 )0;   15143   buff2 = (uint64 )0;
15144   buff3 = (uint64 )0;   15144   buff3 = (uint64 )0;
15145   bytebuff1 = (uint8 )0;   15145   bytebuff1 = (uint8 )0;
15146   bytebuff2 = (uint8 )0;   15146   bytebuff2 = (uint8 )0;
15147   bytebuff3 = (uint8 )0;   15147   bytebuff3 = (uint8 )0;
15148   bytebuff4 = (uint8 )0;   15148   bytebuff4 = (uint8 )0;
15149   if ((unsigned int )ibuff == (unsigned int )((void *)0)) {   15149   if ((unsigned int )ibuff == (unsigned int )((void *)0)) {
15150     TIFFError("reverseSamples32bits", "Invalid image or work buffer");   15150     TIFFError("reverseSamples32bits", "Invalid image or work buffer");
15151     return (1);   15151     return (1);
15152   } else   15152   } else
15153   if ((unsigned int )obuff == (unsigned int )((void *)0)) {   15153   if ((unsigned int )obuff == (unsigned int )((void *)0)) {
15154     TIFFError("reverseSamples32bits", "Invalid image or work buffer");   15154     TIFFError("reverseSamples32bits", "Invalid image or work buffer");
15155     return (1);   15155     return (1);
15156   } else {   15156   } else {
15157     15157  
15158   }   15158   }
15159   ready_bits = 0;   15159   ready_bits = 0;
15160   maskbits = 0xffffffffffffffffULL >> (64 - (int )bps);   15160   maskbits = 0xffffffffffffffffULL >> (64 - (int )bps);
15161   dst = obuff;   15161   dst = obuff;
15162   bytes_per_sample = ((int )bps + 7) / 8;   15162   bytes_per_sample = ((int )bps + 7) / 8;
15163   bytes_per_pixel = ((int )bps * (int )spp + 7) / 8;   15163   bytes_per_pixel = ((int )bps * (int )spp + 7) / 8;
15164   if (bytes_per_pixel < bytes_per_sample + 1) {   15164   if (bytes_per_pixel < bytes_per_sample + 1) {
15165     shift_width = bytes_per_pixel;   15165     shift_width = bytes_per_pixel;
15166   } else {   15166   } else {
15167     shift_width = bytes_per_sample + 1;   15167     shift_width = bytes_per_sample + 1;
15168   }   15168   }
15169   col = width;   15169   col = width;
15170   while (col > 0U) {   15170   while (col > 0U) {
15171     bit_offset = ((col - 1U) * (uint32 )bps) * (uint32 )spp;   15171     bit_offset = ((col - 1U) * (uint32 )bps) * (uint32 )spp;
15172     sample = (tsample_t )0;   15172     sample = (tsample_t )0;
15173     while ((int )sample < (int )spp) {   15173     while ((int )sample < (int )spp) {
15174       if ((int )sample == 0) {   15174       if ((int )sample == 0) {
15175         src_byte = bit_offset / 8U;   15175         src_byte = bit_offset / 8U;
15176         src_bit = bit_offset % 8U;   15176         src_bit = bit_offset % 8U;
15177       } else {   15177       } else {
15178         src_byte = (bit_offset + (uint32 )((int )sample * (int )bps)) / 8U;   15178         src_byte = (bit_offset + (uint32 )((int )sample * (int )bps)) / 8U;
15179         src_bit = (bit_offset + (uint32 )((int )sample * (int )bps)) % 8U;   15179         src_bit = (bit_offset + (uint32 )((int )sample * (int )bps)) % 8U;
15180       }   15180       }
15181       src = ibuff + src_byte;   15181       src = ibuff + src_byte;
15182       matchbits = maskbits << ((64U - src_bit) - (uint32 )bps);   15182       matchbits = maskbits << ((64U - src_bit) - (uint32 )bps);
15183       if (little_endian) {   15183       if (little_endian) {
15184         swapbuff1[3] = *src;   15184         swapbuff1[3] = *src;
15185         swapbuff1[2] = *(src + 1);   15185         swapbuff1[2] = *(src + 1);
15186         swapbuff1[1] = *(src + 2);   15186         swapbuff1[1] = *(src + 2);
15187         swapbuff1[0] = *(src + 3);   15187         swapbuff1[0] = *(src + 3);
15188       } else {   15188       } else {
15189         swapbuff1[0] = *src;   15189         swapbuff1[0] = *src;
15190         swapbuff1[1] = *(src + 1);   15190         swapbuff1[1] = *(src + 1);
15191         swapbuff1[2] = *(src + 2);   15191         swapbuff1[2] = *(src + 2);
15192         swapbuff1[3] = *(src + 3);   15192         swapbuff1[3] = *(src + 3);
15193       }   15193       }
15194       longbuff1 = *((uint32 *)(swapbuff1));   15194       longbuff1 = *((uint32 *)(swapbuff1));
15195       memset((void *)(swapbuff2), '\000', sizeof(swapbuff2));   15195       memset((void *)(swapbuff2), '\000', sizeof(swapbuff2));
15196       if (little_endian) {   15196       if (little_endian) {
15197         swapbuff2[3] = *src;   15197         swapbuff2[3] = *src;
15198         swapbuff2[2] = *(src + 1);   15198         swapbuff2[2] = *(src + 1);
15199         swapbuff2[1] = *(src + 2);   15199         swapbuff2[1] = *(src + 2);
15200         swapbuff2[0] = *(src + 3);   15200         swapbuff2[0] = *(src + 3);
15201       } else {   15201       } else {
15202         swapbuff2[0] = *src;   15202         swapbuff2[0] = *src;
15203         swapbuff2[1] = *(src + 1);   15203         swapbuff2[1] = *(src + 1);
15204         swapbuff2[2] = *(src + 2);   15204         swapbuff2[2] = *(src + 2);
15205         swapbuff2[3] = *(src + 3);   15205         swapbuff2[3] = *(src + 3);
15206       }   15206       }
15207       longbuff2 = *((uint32 *)(swapbuff2));   15207       longbuff2 = *((uint32 *)(swapbuff2));
15208       buff3 = ((uint64 )longbuff1 << 32) | (unsigned long long )longbuff2;   15208       buff3 = ((uint64 )longbuff1 << 32) | (unsigned long long )longbuff2;
15209       buff1 = (buff3 & matchbits) << src_bit;   15209       buff1 = (buff3 & matchbits) << src_bit;
15210       if (ready_bits < 32) {   15210       if (ready_bits < 32) {
15211         bytebuff4 = (uint8 )0;   15211         bytebuff4 = (uint8 )0;
15212         bytebuff3 = bytebuff4;   15212         bytebuff3 = bytebuff4;
15213         bytebuff2 = bytebuff3;   15213         bytebuff2 = bytebuff3;
15214         bytebuff1 = bytebuff2;   15214         bytebuff1 = bytebuff2;
15215         buff2 |= buff1 >> ready_bits;   15215         buff2 |= buff1 >> ready_bits;
15216       } else {   15216       } else {
15217         bytebuff1 = (uint8 )(buff2 >> 56);   15217         bytebuff1 = (uint8 )(buff2 >> 56);
15218         tmp = dst;   15218         tmp = dst;
15219         dst ++;   15219         dst ++;
15220         *tmp = bytebuff1;   15220         *tmp = bytebuff1;
15221         bytebuff2 = (uint8 )(buff2 >> 48);   15221         bytebuff2 = (uint8 )(buff2 >> 48);
15222         tmp___0 = dst;   15222         tmp___0 = dst;
15223         dst ++;   15223         dst ++;
15224         *tmp___0 = bytebuff2;   15224         *tmp___0 = bytebuff2;
15225         bytebuff3 = (uint8 )(buff2 >> 40);   15225         bytebuff3 = (uint8 )(buff2 >> 40);
15226         tmp___1 = dst;   15226         tmp___1 = dst;
15227         dst ++;   15227         dst ++;
15228         *tmp___1 = bytebuff3;   15228         *tmp___1 = bytebuff3;
15229         bytebuff4 = (uint8 )(buff2 >> 32);   15229         bytebuff4 = (uint8 )(buff2 >> 32);
15230         tmp___2 = dst;   15230         tmp___2 = dst;
15231         dst ++;   15231         dst ++;
15232         *tmp___2 = bytebuff4;   15232         *tmp___2 = bytebuff4;
15233         ready_bits -= 32;   15233         ready_bits -= 32;
15234         buff2 = (buff2 << 32) | (buff1 >> ready_bits);   15234         buff2 = (buff2 << 32) | (buff1 >> ready_bits);
15235       }   15235       }
15236       ready_bits += (int )bps;   15236       ready_bits += (int )bps;
15237       sample = (tsample_t )((int )sample + 1);   15237       sample = (tsample_t )((int )sample + 1);
15238     }   15238     }
15239     col --;   15239     col --;
15240   }   15240   }
15241   while (ready_bits > 0) {   15241   while (ready_bits > 0) {
15242     bytebuff1 = (uint8 )(buff2 >> 56);   15242     bytebuff1 = (uint8 )(buff2 >> 56);
15243     tmp___3 = dst;   15243     tmp___3 = dst;
15244     dst ++;   15244     dst ++;
15245     *tmp___3 = bytebuff1;   15245     *tmp___3 = bytebuff1;
15246     buff2 <<= 8;   15246     buff2 <<= 8;
15247     ready_bits -= 8;   15247     ready_bits -= 8;
15248   }   15248   }
15249   return (0);   15249   return (0);
15250 }   15250 }
15251 }   15251 }
15252 static int reverseSamplesBytes(uint16 spp , uint16 bps , uint32 width ,   15252 static int reverseSamplesBytes(uint16 spp , uint16 bps , uint32 width ,
15253                                uint8 *src , uint8 *dst )   15253                                uint8 *src , uint8 *dst )
15254 {   15254 {
15255   int i ;   15255   int i ;
15256   uint32 col ;   15256   uint32 col ;
15257   uint32 bytes_per_pixel ;   15257   uint32 bytes_per_pixel ;
15258   uint32 col_offset ;   15258   uint32 col_offset ;
15259   uint8 bytebuff1 ;   15259   uint8 bytebuff1 ;
15260   unsigned char swapbuff[32] ;   15260   unsigned char swapbuff[32] ;
15261   uint8 *tmp ;   15261   uint8 *tmp ;
15262     15262  
15263   {   15263   {
15264   if ((unsigned int )src == (unsigned int )((void *)0)) {   15264   if ((unsigned int )src == (unsigned int )((void *)0)) {
15265     TIFFError("reverseSamplesBytes", "Invalid input or output buffer");   15265     TIFFError("reverseSamplesBytes", "Invalid input or output buffer");
15266     return (1);   15266     return (1);
15267   } else   15267   } else
15268   if ((unsigned int )dst == (unsigned int )((void *)0)) {   15268   if ((unsigned int )dst == (unsigned int )((void *)0)) {
15269     TIFFError("reverseSamplesBytes", "Invalid input or output buffer");   15269     TIFFError("reverseSamplesBytes", "Invalid input or output buffer");
15270     return (1);   15270     return (1);
15271   } else {   15271   } else {
15272     15272  
15273   }   15273   }
15274   bytes_per_pixel = (uint32 )(((int )bps * (int )spp + 7) / 8);   15274   bytes_per_pixel = (uint32 )(((int )bps * (int )spp + 7) / 8);
15275   switch ((int )bps / 8) {   15275   switch ((int )bps / 8) {
15276   case 2:   15276   case 2:
15277   case 3:   15277   case 3:
15278   case 4:   15278   case 4:
15279   case 8:   15279   case 8:
15280   col = (uint32 )0;   15280   col = (uint32 )0;
15281   while (col < width / 2U) {   15281   while (col < width / 2U) {
15282     col_offset = col * bytes_per_pixel;   15282     col_offset = col * bytes_per_pixel;
15283     _TIFFmemcpy((void *)(swapbuff), (void const   *)(src + col_offset),   15283     _TIFFmemcpy((void *)(swapbuff), (void const   *)(src + col_offset),
15284                 (tmsize_t )bytes_per_pixel);   15284                 (tmsize_t )bytes_per_pixel);
15285     _TIFFmemcpy((void *)(src + col_offset),   15285     _TIFFmemcpy((void *)(src + col_offset),
15286                 (void const   *)((dst - col_offset) - bytes_per_pixel),   15286                 (void const   *)((dst - col_offset) - bytes_per_pixel),
15287                 (tmsize_t )bytes_per_pixel);   15287                 (tmsize_t )bytes_per_pixel);
15288     _TIFFmemcpy((void *)((dst - col_offset) - bytes_per_pixel),   15288     _TIFFmemcpy((void *)((dst - col_offset) - bytes_per_pixel),
15289                 (void const   *)(swapbuff), (tmsize_t )bytes_per_pixel);   15289                 (void const   *)(swapbuff), (tmsize_t )bytes_per_pixel);
15290     col ++;   15290     col ++;
15291   }   15291   }
15292   break;   15292   break;
15293   case 1:   15293   case 1:
15294   col = (uint32 )0;   15294   col = (uint32 )0;
15295   while (col < width / 2U) {   15295   while (col < width / 2U) {
15296     i = 0;   15296     i = 0;
15297     while (i < (int )spp) {   15297     while (i < (int )spp) {
15298       bytebuff1 = *src;   15298       bytebuff1 = *src;
15299       tmp = src;   15299       tmp = src;
15300       src ++;   15300       src ++;
15301       *tmp = *((dst - (int )spp) + i);   15301       *tmp = *((dst - (int )spp) + i);
15302       *((dst - (int )spp) + i) = bytebuff1;   15302       *((dst - (int )spp) + i) = bytebuff1;
15303       i ++;   15303       i ++;
15304     }   15304     }
15305     dst -= (int )spp;   15305     dst -= (int )spp;
15306     col ++;   15306     col ++;
15307   }   15307   }
15308   break;   15308   break;
15309   default:   15309   default:
15310   TIFFError("reverseSamplesBytes", "Unsupported bit depth %d", (int )bps);   15310   TIFFError("reverseSamplesBytes", "Unsupported bit depth %d", (int )bps);
15311   return (1);   15311   return (1);
15312   }   15312   }
15313   return (0);   15313   return (0);
15314 }   15314 }
15315 }   15315 }
15316 static int mirrorImage(uint16 spp , uint16 bps , uint16 mirror , uint32 width ,   15316 static int mirrorImage(uint16 spp , uint16 bps , uint16 mirror , uint32 width ,
15317                        uint32 length , unsigned char *ibuff )   15317                        uint32 length , unsigned char *ibuff )
15318 {   15318 {
15319   int shift_width ;   15319   int shift_width ;
15320   uint32 bytes_per_pixel ;   15320   uint32 bytes_per_pixel ;
15321   uint32 bytes_per_sample ;   15321   uint32 bytes_per_sample ;
15322   uint32 row ;   15322   uint32 row ;
15323   uint32 rowsize ;   15323   uint32 rowsize ;
15324   uint32 row_offset ;   15324   uint32 row_offset ;
15325   unsigned char *line_buff ;   15325   unsigned char *line_buff ;
15326   unsigned char *src ;   15326   unsigned char *src ;
15327   unsigned char *dst ;   15327   unsigned char *dst ;
15328   void *tmp ;   15328   void *tmp ;
15329   int tmp___0 ;   15329   int tmp___0 ;
15330   void *tmp___1 ;   15330   void *tmp___1 ;
15331   int tmp___2 ;   15331   int tmp___2 ;
15332   int tmp___3 ;   15332   int tmp___3 ;
15333   int tmp___4 ;   15333   int tmp___4 ;
15334   int tmp___5 ;   15334   int tmp___5 ;
15335     15335  
15336   {   15336   {
15337   line_buff = (unsigned char *)((void *)0);   15337   line_buff = (unsigned char *)((void *)0);
15338   src = ibuff;   15338   src = ibuff;
15339   rowsize = ((width * (uint32 )bps) * (uint32 )spp + 7U) / 8U;   15339   rowsize = ((width * (uint32 )bps) * (uint32 )spp + 7U) / 8U;
15340   switch ((int )mirror) {   15340   switch ((int )mirror) {
15341   case 2:   15341   case 2:
15342   case 3:   15342   case 3:
15343   tmp = _TIFFmalloc((tmsize_t )rowsize);   15343   tmp = _TIFFmalloc((tmsize_t )rowsize);
15344   line_buff = (unsigned char *)tmp;   15344   line_buff = (unsigned char *)tmp;
15345   if ((unsigned int )line_buff == (unsigned int )((void *)0)) {   15345   if ((unsigned int )line_buff == (unsigned int )((void *)0)) {
15346     TIFFError("mirrorImage",   15346     TIFFError("mirrorImage",
15347               "Unable to allocate mirror line buffer of %1u bytes", rowsize);   15347               "Unable to allocate mirror line buffer of %1u bytes", rowsize);
15348     return (-1);   15348     return (-1);
15349   } else {   15349   } else {
15350     15350  
15351   }   15351   }
15352   dst = ibuff + rowsize * (length - 1U);   15352   dst = ibuff + rowsize * (length - 1U);
15353   row = (uint32 )0;   15353   row = (uint32 )0;
15354   while (row < length / 2U) {   15354   while (row < length / 2U) {
15355     _TIFFmemcpy((void *)line_buff, (void const   *)src, (tmsize_t )rowsize);   15355     _TIFFmemcpy((void *)line_buff, (void const   *)src, (tmsize_t )rowsize);
15356     _TIFFmemcpy((void *)src, (void const   *)dst, (tmsize_t )rowsize);   15356     _TIFFmemcpy((void *)src, (void const   *)dst, (tmsize_t )rowsize);
15357     _TIFFmemcpy((void *)dst, (void const   *)line_buff, (tmsize_t )rowsize);   15357     _TIFFmemcpy((void *)dst, (void const   *)line_buff, (tmsize_t )rowsize);
15358     src += rowsize;   15358     src += rowsize;
15359     dst -= rowsize;   15359     dst -= rowsize;
15360     row ++;   15360     row ++;
15361   }   15361   }
15362   if (line_buff) {   15362   if (line_buff) {
15363     _TIFFfree((void *)line_buff);   15363     _TIFFfree((void *)line_buff);
15364   } else {   15364   } else {
15365     15365  
15366   }   15366   }
15367   if ((int )mirror == 2) {   15367   if ((int )mirror == 2) {
15368     break;   15368     break;
15369   } else {   15369   } else {
15370     15370  
15371   }   15371   }
15372   case 1:   15372   case 1:
15373   if ((int )bps % 8 == 0) {   15373   if ((int )bps % 8 == 0) {
15374     row = (uint32 )0;   15374     row = (uint32 )0;
15375     while (row < length) {   15375     while (row < length) {
15376       row_offset = row * rowsize;   15376       row_offset = row * rowsize;
15377       src = ibuff + row_offset;   15377       src = ibuff + row_offset;
15378       dst = (ibuff + row_offset) + rowsize;   15378       dst = (ibuff + row_offset) + rowsize;
15379       tmp___0 = reverseSamplesBytes(spp, bps, width, src, dst);   15379       tmp___0 = reverseSamplesBytes(spp, bps, width, src, dst);
15380       if (tmp___0) {   15380       if (tmp___0) {
15381         return (-1);   15381         return (-1);
15382       } else {   15382       } else {
15383     15383  
15384       }   15384       }
15385       row ++;   15385       row ++;
15386     }   15386     }
15387   } else {   15387   } else {
15388     tmp___1 = _TIFFmalloc((tmsize_t )(rowsize + 1U));   15388     tmp___1 = _TIFFmalloc((tmsize_t )(rowsize + 1U));
15389     line_buff = (unsigned char *)tmp___1;   15389     line_buff = (unsigned char *)tmp___1;
15390     if (line_buff) {   15390     if (line_buff) {
15391     15391  
15392     } else {   15392     } else {
15393       TIFFError("mirrorImage", "Unable to allocate mirror line buffer");   15393       TIFFError("mirrorImage", "Unable to allocate mirror line buffer");
15394       return (-1);   15394       return (-1);
15395     }   15395     }
15396     bytes_per_sample = (uint32 )(((int )bps + 7) / 8);   15396     bytes_per_sample = (uint32 )(((int )bps + 7) / 8);
15397     bytes_per_pixel = (uint32 )(((int )bps * (int )spp + 7) / 8);   15397     bytes_per_pixel = (uint32 )(((int )bps * (int )spp + 7) / 8);
15398     if (bytes_per_pixel < bytes_per_sample + 1U) {   15398     if (bytes_per_pixel < bytes_per_sample + 1U) {
15399       shift_width = (int )bytes_per_pixel;   15399       shift_width = (int )bytes_per_pixel;
15400     } else {   15400     } else {
15401       shift_width = (int )(bytes_per_sample + 1U);   15401       shift_width = (int )(bytes_per_sample + 1U);
15402     }   15402     }
15403     row = (uint32 )0;   15403     row = (uint32 )0;
15404     while (row < length) {   15404     while (row < length) {
15405       row_offset = row * rowsize;   15405       row_offset = row * rowsize;
15406       src = ibuff + row_offset;   15406       src = ibuff + row_offset;
15407       _TIFFmemset((void *)line_buff, '\000', (tmsize_t )rowsize);   15407       _TIFFmemset((void *)line_buff, '\000', (tmsize_t )rowsize);
15408       switch (shift_width) {   15408       switch (shift_width) {
15409       case 1:   15409       case 1:
15410       tmp___2 = reverseSamples8bits(spp, bps, width, src, line_buff);   15410       tmp___2 = reverseSamples8bits(spp, bps, width, src, line_buff);
15411       if (tmp___2) {   15411       if (tmp___2) {
15412         _TIFFfree((void *)line_buff);   15412         _TIFFfree((void *)line_buff);
15413         return (-1);   15413         return (-1);
15414       } else {   15414       } else {
15415     15415  
15416       }   15416       }
15417       _TIFFmemcpy((void *)src, (void const   *)line_buff, (tmsize_t )rowsize);   15417       _TIFFmemcpy((void *)src, (void const   *)line_buff, (tmsize_t )rowsize);
15418       break;   15418       break;
15419       case 2:   15419       case 2:
15420       tmp___3 = reverseSamples16bits(spp, bps, width, src, line_buff);   15420       tmp___3 = reverseSamples16bits(spp, bps, width, src, line_buff);
15421       if (tmp___3) {   15421       if (tmp___3) {
15422         _TIFFfree((void *)line_buff);   15422         _TIFFfree((void *)line_buff);
15423         return (-1);   15423         return (-1);
15424       } else {   15424       } else {
15425     15425  
15426       }   15426       }
15427       _TIFFmemcpy((void *)src, (void const   *)line_buff, (tmsize_t )rowsize);   15427       _TIFFmemcpy((void *)src, (void const   *)line_buff, (tmsize_t )rowsize);
15428       break;   15428       break;
15429       case 3:   15429       case 3:
15430       tmp___4 = reverseSamples24bits(spp, bps, width, src, line_buff);   15430       tmp___4 = reverseSamples24bits(spp, bps, width, src, line_buff);
15431       if (tmp___4) {   15431       if (tmp___4) {
15432         _TIFFfree((void *)line_buff);   15432         _TIFFfree((void *)line_buff);
15433         return (-1);   15433         return (-1);
15434       } else {   15434       } else {
15435     15435  
15436       }   15436       }
15437       _TIFFmemcpy((void *)src, (void const   *)line_buff, (tmsize_t )rowsize);   15437       _TIFFmemcpy((void *)src, (void const   *)line_buff, (tmsize_t )rowsize);
15438       break;   15438       break;
15439       case 5:   15439       case 5:
15440       case 4:   15440       case 4:
15441       tmp___5 = reverseSamples32bits(spp, bps, width, src, line_buff);   15441       tmp___5 = reverseSamples32bits(spp, bps, width, src, line_buff);
15442       if (tmp___5) {   15442       if (tmp___5) {
15443         _TIFFfree((void *)line_buff);   15443         _TIFFfree((void *)line_buff);
15444         return (-1);   15444         return (-1);
15445       } else {   15445       } else {
15446     15446  
15447       }   15447       }
15448       _TIFFmemcpy((void *)src, (void const   *)line_buff, (tmsize_t )rowsize);   15448       _TIFFmemcpy((void *)src, (void const   *)line_buff, (tmsize_t )rowsize);
15449       break;   15449       break;
15450       default:   15450       default:
15451       TIFFError("mirrorImage", "Unsupported bit depth %d", (int )bps);   15451       TIFFError("mirrorImage", "Unsupported bit depth %d", (int )bps);
15452       _TIFFfree((void *)line_buff);   15452       _TIFFfree((void *)line_buff);
15453       return (-1);   15453       return (-1);
15454       }   15454       }
15455       row ++;   15455       row ++;
15456     }   15456     }
15457     if (line_buff) {   15457     if (line_buff) {
15458       _TIFFfree((void *)line_buff);   15458       _TIFFfree((void *)line_buff);
15459     } else {   15459     } else {
15460     15460  
15461     }   15461     }
15462   }   15462   }
15463   break;   15463   break;
15464   default:   15464   default:
15465   TIFFError("mirrorImage", "Invalid mirror axis %d", (int )mirror);   15465   TIFFError("mirrorImage", "Invalid mirror axis %d", (int )mirror);
15466   return (-1);   15466   return (-1);
15467   break;   15467   break;
15468   }   15468   }
15469   return (0);   15469   return (0);
15470 }   15470 }
15471 }   15471 }
15472 static int invertImage(uint16 photometric , uint16 spp , uint16 bps ,   15472 static int invertImage(uint16 photometric , uint16 spp , uint16 bps ,
15473                        uint32 width , uint32 length , unsigned char *work_buff )   15473                        uint32 width , uint32 length , unsigned char *work_buff )
15474 {   15474 {
15475   uint32 row ;   15475   uint32 row ;
15476   uint32 col ;   15476   uint32 col ;
15477   unsigned char bytebuff1 ;   15477   unsigned char bytebuff1 ;
15478   unsigned char bytebuff2 ;   15478   unsigned char bytebuff2 ;
15479   unsigned char bytebuff3 ;   15479   unsigned char bytebuff3 ;
15480   unsigned char bytebuff4 ;   15480   unsigned char bytebuff4 ;
15481   unsigned char *src ;   15481   unsigned char *src ;
15482   uint16 *src_uint16 ;   15482   uint16 *src_uint16 ;
15483   uint32 *src_uint32 ;   15483   uint32 *src_uint32 ;
15484   int tmp ;   15484   int tmp ;
15485     15485  
15486   {   15486   {
15487   if ((int )spp != 1) {   15487   if ((int )spp != 1) {
15488     TIFFError("invertImage",   15488     TIFFError("invertImage",
15489               "Image inversion not supported for more than one sample per pixel");   15489               "Image inversion not supported for more than one sample per pixel");
15490     return (-1);   15490     return (-1);
15491   } else {   15491   } else {
15492     15492  
15493   }   15493   }
15494   if ((int )photometric != 0) {   15494   if ((int )photometric != 0) {
15495     if ((int )photometric != 1) {   15495     if ((int )photometric != 1) {
15496       TIFFError("invertImage",   15496       TIFFError("invertImage",
15497                 "Only black and white and grayscale images can be inverted");   15497                 "Only black and white and grayscale images can be inverted");
15498       return (-1);   15498       return (-1);
15499     } else {   15499     } else {
15500     15500  
15501     }   15501     }
15502   } else {   15502   } else {
15503     15503  
15504   }   15504   }
15505   src = work_buff;   15505   src = work_buff;
15506   if ((unsigned int )src == (unsigned int )((void *)0)) {   15506   if ((unsigned int )src == (unsigned int )((void *)0)) {
15507     TIFFError("invertImage", "Invalid crop buffer passed to invertImage");   15507     TIFFError("invertImage", "Invalid crop buffer passed to invertImage");
15508     return (-1);   15508     return (-1);
15509   } else {   15509   } else {
15510     15510  
15511   }   15511   }
15512   switch ((int )bps) {   15512   switch ((int )bps) {
15513   case 32:   15513   case 32:
15514   src_uint32 = (uint32 *)src;   15514   src_uint32 = (uint32 *)src;
15515   row = (uint32 )0;   15515   row = (uint32 )0;
15516   while (row < length) {   15516   while (row < length) {
15517     col = (uint32 )0;   15517     col = (uint32 )0;
15518     while (col < width) {   15518     while (col < width) {
15519       *src_uint32 = 4294967295U - *src_uint32;   15519       *src_uint32 = 4294967295U - *src_uint32;
15520       src_uint32 ++;   15520       src_uint32 ++;
15521       col ++;   15521       col ++;
15522     }   15522     }
15523     row ++;   15523     row ++;
15524   }   15524   }
15525   break;   15525   break;
15526   case 16:   15526   case 16:
15527   src_uint16 = (uint16 *)src;   15527   src_uint16 = (uint16 *)src;
15528   row = (uint32 )0;   15528   row = (uint32 )0;
15529   while (row < length) {   15529   while (row < length) {
15530     col = (uint32 )0;   15530     col = (uint32 )0;
15531     while (col < width) {   15531     while (col < width) {
15532       *src_uint16 = (uint16 )(65535 - (int )*src_uint16);   15532       *src_uint16 = (uint16 )(65535 - (int )*src_uint16);
15533       src_uint16 ++;   15533       src_uint16 ++;
15534       col ++;   15534       col ++;
15535     }   15535     }
15536     row ++;   15536     row ++;
15537   }   15537   }
15538   break;   15538   break;
15539   case 8:   15539   case 8:
15540   row = (uint32 )0;   15540   row = (uint32 )0;
15541   while (row < length) {   15541   while (row < length) {
15542     col = (uint32 )0;   15542     col = (uint32 )0;
15543     while (col < width) {   15543     while (col < width) {
15544       *src = (unsigned char )(255 - (int )*src);   15544       *src = (unsigned char )(255 - (int )*src);
15545       src ++;   15545       src ++;
15546       col ++;   15546       col ++;
15547     }   15547     }
15548     row ++;   15548     row ++;
15549   }   15549   }
15550   break;   15550   break;
15551   case 4:   15551   case 4:
15552   row = (uint32 )0;   15552   row = (uint32 )0;
15553   while (row < length) {   15553   while (row < length) {
15554     col = (uint32 )0;   15554     col = (uint32 )0;
15555     while (col < width) {   15555     while (col < width) {
15556       bytebuff1 = (unsigned char )(16 - (int )((uint8 )((int )*src & (240 >> 4))));   15556       bytebuff1 = (unsigned char )(16 - (int )((uint8 )((int )*src & (240 >> 4))));
15557       bytebuff2 = (unsigned char )(16 - ((int )*src & 15));   15557       bytebuff2 = (unsigned char )(16 - ((int )*src & 15));
15558       *src = (unsigned char )(((int )bytebuff1 << 4) & (int )bytebuff2);   15558       *src = (unsigned char )(((int )bytebuff1 << 4) & (int )bytebuff2);
15559       src ++;   15559       src ++;
15560       col ++;   15560       col ++;
15561     }   15561     }
15562     row ++;   15562     row ++;
15563   }   15563   }
15564   break;   15564   break;
15565   case 2:   15565   case 2:
15566   row = (uint32 )0;   15566   row = (uint32 )0;
15567   while (row < length) {   15567   while (row < length) {
15568     col = (uint32 )0;   15568     col = (uint32 )0;
15569     while (col < width) {   15569     while (col < width) {
15570       bytebuff1 = (unsigned char )(4 - (int )((uint8 )((int )*src & (192 >> 6))));   15570       bytebuff1 = (unsigned char )(4 - (int )((uint8 )((int )*src & (192 >> 6))));
15571       bytebuff2 = (unsigned char )(4 - (int )((uint8 )((int )*src & (48 >> 4))));   15571       bytebuff2 = (unsigned char )(4 - (int )((uint8 )((int )*src & (48 >> 4))));
15572       bytebuff3 = (unsigned char )(4 - (int )((uint8 )((int )*src & (12 >> 2))));   15572       bytebuff3 = (unsigned char )(4 - (int )((uint8 )((int )*src & (12 >> 2))));
15573       bytebuff4 = (unsigned char )(4 - (int )((uint8 )((int )*src & 3)));   15573       bytebuff4 = (unsigned char )(4 - (int )((uint8 )((int )*src & 3)));
15574       if ((int )bytebuff1 << 6) {   15574       if ((int )bytebuff1 << 6) {
15575         tmp = 1;   15575         tmp = 1;
15576       } else   15576       } else
15577       if ((int )bytebuff2 << 4) {   15577       if ((int )bytebuff2 << 4) {
15578         tmp = 1;   15578         tmp = 1;
15579       } else   15579       } else
15580       if ((int )bytebuff3 << 2) {   15580       if ((int )bytebuff3 << 2) {
15581         tmp = 1;   15581         tmp = 1;
15582       } else   15582       } else
15583       if (bytebuff4) {   15583       if (bytebuff4) {
15584         tmp = 1;   15584         tmp = 1;
15585       } else {   15585       } else {
15586         tmp = 0;   15586         tmp = 0;
15587       }   15587       }
15588       *src = (unsigned char )tmp;   15588       *src = (unsigned char )tmp;
15589       src ++;   15589       src ++;
15590       col ++;   15590       col ++;
15591     }   15591     }
15592     row ++;   15592     row ++;
15593   }   15593   }
15594   break;   15594   break;
15595   case 1:   15595   case 1:
15596   row = (uint32 )0;   15596   row = (uint32 )0;
15597   while (row < length) {   15597   while (row < length) {
15598     col = (uint32 )0;   15598     col = (uint32 )0;
15599     while (col < width) {   15599     while (col < width) {
15600       *src = (unsigned char )(~ ((int )*src));   15600       *src = (unsigned char )(~ ((int )*src));
15601       src ++;   15601       src ++;
15602       col += (uint32 )(8 / ((int )spp * (int )bps));   15602       col += (uint32 )(8 / ((int )spp * (int )bps));
15603     }   15603     }
15604     row ++;   15604     row ++;
15605   }   15605   }
15606   break;   15606   break;
15607   default:   15607   default:
15608   TIFFError("invertImage", "Unsupported bit depth %d", (int )bps);   15608   TIFFError("invertImage", "Unsupported bit depth %d", (int )bps);
15609   return (-1);   15609   return (-1);
15610   }   15610   }
15611   return (0);   15611   return (0);
15612 }   15612 }
15613 }   15613 }